Page 1 of 1

Wrong display of DCRADIOBUTTON

Posted: Thu Feb 25, 2010 6:21 am
by Markus Walter
Hello Roger,

i have still a problem with displaying DCRADIOBUTTONs (there was a thread several month ago in webboard).

1. It seems that vertical alignment is *very* Bottom, so some characters are cut ("g" for example)

2. Using "OPTIONS BS_VCENTER" leads to a Pushbutton-Style (without using BS_PUSHBUTTON)

Is this corrected with build 253 or 254 (i still use 252).

Sample:

Code: Select all

#include "dcdialog.ch"

PROCEDURE main
LOCAL GetList := {}, cOption, asize := { , 35}, oStatic

cOption := 'P'

@ 10, 10 DCSTATIC TYPE XBPSTATIC_TYPE_GROUPBOX SIZE 200, 200 OBJECT oStatic CAPTION "Test" PIXEL
@ 20,10 DCRADIOBUTTON cOption VALUE 'D' PROMPT 'Angebot' SIZE asize[1], asize[2] PIXEL PARENT oStatic
@ 45,10 DCRADIOBUTTON cOption VALUE 'S' PROMPT 'Auftrag' SIZE asize[1], asize[2] PIXEL PARENT oStatic
@ 70,10 DCRADIOBUTTON cOption VALUE 'B' PROMPT 'Rechnung' SIZE asize[1], asize[2] PIXEL PARENT oStatic OPTIONS BS_VCENTER
@ 95,10 DCRADIOBUTTON cOption VALUE 'P' PROMPT 'Archiv' SIZE asize[1], asize[2] PIXEL PARENT oStatic OPTIONS BS_VCENTER

DCREAD GUI ;
  TITLE 'Radio Button Demo' ;
  ADDBUTTONS ;
  FIT

RETURN
Perhaps you can starting the Thread with the changes of each build, we have discussed about?

Re: Wrong display of DCRADIOBUTTON

Posted: Thu Feb 25, 2010 8:22 am
by rdonnay
The BS_* options are defines from the windows api that are used by the following code:

Code: Select all

IF Valtype(::options) == 'N'
  nOptions := GetWindowLonga(::GetHwnd(), GWL_STYLE) + ::options
  SetWindowLongA(::GetHwnd(), GWL_STYLE, nOptions )
ENDIF
It is very possible that the options you chose do not correlate with a radiobutton object and therefore the undesired result.

As far as the cut "g" is concerned, I don't know why this is happening because I am using the :autoSize feature of the XbpRadiobutton class as so:

Code: Select all

::size := aSize
DEFAULT ::size := {0,0}
IF Empty(::size[1])
  ::size[2] := 0
  lAutoSize := .t.
ENDIF
Possibly the above code isn't working correctly. To determine this try one of the following:

Code: Select all

@ .. DCRADIOBUTTON .. PREEVAL {|o|o:autoSize := .t.}

or

@ .. DCRADIOBUTTON .. SIZE < nWidth>, <nHeight>  << give it a size

Re: Wrong display of DCRADIOBUTTON

Posted: Thu Feb 25, 2010 9:15 am
by Markus Walter
Hi Roger,

it seems to depend of the xSize (Width)?!?!

Please test with this code:
#include "dcdialog.ch"

PROCEDURE main
LOCAL GetList := {}, cOption, oStatic, asize

cOption := 'P'

asize := { 150, 20}
// asize := { , 20} // take this to see the problem

@ 10, 10 DCSTATIC TYPE XBPSTATIC_TYPE_GROUPBOX SIZE 200, 200 OBJECT oStatic CAPTION "Test" PIXEL

@ 20,10 DCRADIOBUTTON cOption VALUE 'D' PROMPT 'Angebot' SIZE asize[1], asize[2] PIXEL PARENT oStatic
@ 45,10 DCRADIOBUTTON cOption VALUE 'S' PROMPT 'Auftrag' SIZE asize[1], asize[2] PIXEL PARENT oStatic PREEVAL {|o|o:autoSize := .t.}
@ 70,10 DCRADIOBUTTON cOption VALUE 'B' PROMPT 'Rechnung' PIXEL PARENT oStatic PREEVAL {|o|o:autoSize := .t.}
@ 95,10 DCRADIOBUTTON cOption VALUE 'P' PROMPT 'Archiv' PIXEL PARENT oStatic PREEVAL {|o|o:autoSize := .t.}

DCREAD GUI ;
TITLE 'Radio Button Demo' ;
ADDBUTTONS ;
FIT

RETURN
It's only correct, if i use a width in aSize. If i only use ySize, then the alignment is not correct (cut "g"). The same result with PREEVAL {|o|o:autoSize := .t.}