Page 1 of 1

DCSAY with SAYSIZE 0, x

Posted: Wed Jun 22, 2011 2:26 am
by Markus Walter
Hello,

i have a problem. I always use SAYSIZE 0, x with DCSAY, because i want to have the automatic width for the DCSAY. Unfortunately the height of the DCSAY is also automatic set in this case. Is there a posibility to have only the automatic for the width?

This sample shows my problem:

Code: Select all

#include "dcdialog.ch"
#include "appevent.ch"

function Appsys()
return NIL

procedure main()
local getlist := {}, getoptions := {}, lRet, cVar := padr("Test", 20)

  @ 30, 20 DCSAY "TestTest" SAYSIZE 0, 42 SAYFONT "22.MS Sans Serif" SAYVCENTER SAYCOLOR {|| { , GRA_CLR_RED} }
  @ 30, 140 DCGET cVar GETSIZE 300, 42 GETFONT "22.MS Sans Serif"

  DCGETOPTIONS TITLE "Test" PIXEL
  DCREAD GUI TO lRet OPTIONS getoptions ADDBUTTONS FIT

RETURN
I want to have the DCSAY V-Centered in the same height as the SLE.

The attachment show my problem as a screenshot.

Re: DCSAY with SAYSIZE 0, x

Posted: Thu Jun 23, 2011 5:59 pm
by rdonnay
try this:

Code: Select all

@ .. dcsay .. get .. sayeval {|o|CenterSay(o)}


FUNCTION CenterSayOnGet(oSay)

oSay:setPos( {oSay:currentPos()[1], oSay:currentPos()[2] + 4})

RETURN nil

Re: DCSAY with SAYSIZE 0, x

Posted: Fri Jun 24, 2011 1:06 am
by Markus Walter
Hi Roger,

i am looking for a generic solution. I can't use your sample for several reasons. Can you give me a hint, where i found your width calculation for the dcsay? Then i will calc the width myself and not use "Size 0"...

Re: DCSAY with SAYSIZE 0, x

Posted: Fri Jun 24, 2011 1:58 am
by Tom
@Markus: Create a subclass and do it there.

Re: DCSAY with SAYSIZE 0, x

Posted: Fri Jun 24, 2011 10:09 am
by rdonnay
@Markus: Create a subclass and do it there
Why didn't I think of that?
:oops:

Re: DCSAY with SAYSIZE 0, x

Posted: Fri Jun 24, 2011 12:28 pm
by Auge_Ohr
Markus Walter wrote:The attachment show my problem as a screenshot.
while are using Win7 the (need) +4 is "Borderpadding".

Code: Select all

#define SM_CXPADDEDBORDER       92 

   If VAL( OS(OS_VERSION) ) > 5
      ::nPadding     := @USER32:GetSystemMetrics(SM_CXPADDEDBORDER) // using ot4xb Syntax
   ELSE
      ::nPadding     := 0
   ENDIF