Page 1 of 1

Checkbox alignment not correct

Posted: Sun Oct 07, 2007 3:00 pm
by Patrick Mast
Hello,

Please look at following small test application:
Image
Notice that the alignment for the chekboxes are not correct.

This is the PRG part of the reduced sampe to show this:

Code: Select all

#include "FiveWin.ch"

#define CLR_GREY       14342874
#define CLR_WHITE      16777215

Function wfMain()
   LOCAL oDlg, oRadio, lRadio:=.F.
   
   DEFINE DIALOG oDlg NAME "TEST_DIALOG"          
      
   REDEFINE RADIO oRadio VAR lRadio ID 101 OF oDlg COLOR 0, CLR_WHITE 
   REDEFINE RADIO oRadio VAR lRadio ID 102 OF oDlg COLOR 0, CLR_WHITE 
                                     
   ACTIVATE DIALOG oDlg CENTERED RESIZE16
    
   
RETURN NIL
And this is the RC part:

Code: Select all

TEST_DIALOG DIALOG 21, 51, 271, 121
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Test Dialog"
FONT 8, "MS Sans Serif"
{
 CHECKBOX "Checkbox Right", 102, 16, 32, 90, 14, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Checkbox Left :", 101, 17, 16, 80, 14, BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP
}
For your convenience I have ZIP'ed both files into this file:
http://www.WinFakt.be/Ckeckbox_Aligment.zip

Thank you.

Patrick Mast
http://www.winfakt.be

Re: Checkbox alignment not correct

Posted: Sun Oct 07, 2007 3:22 pm
by Enrico Maria Giordano

Code: Select all

 CHECKBOX "Checkbox Right", 102, 16, 32, 80, 14, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Checkbox Left :", 101, 16, 16, 80, 14, BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP
EMG

Re: Checkbox alignment not correct

Posted: Sun Oct 07, 2007 3:34 pm
by Patrick Mast
EnricoMaria wrote:

Code: Select all

 CHECKBOX "Checkbox Right", 102, 16, 32, 80, 14, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Checkbox Left :", 101, 16, 16, 80, 14, BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP
EMG
Not so simple Enrico ;-)

As we do not know what string we will be using for the checkbox. So, the same RC will be used for a checkbox named like "This is a checkbox here" and the other time it will be called for example "test". So, we set the width to the max we can do for that dialog. The checkbox should align the text just next to the checkbox itself.

Running test.exe should look like this no?
Image

Patrick Mast
http://www.winfakt.be

Re: Checkbox alignment not correct

Posted: Sun Oct 07, 2007 4:44 pm
by Enrico Maria Giordano
Sorry Patrick but I really don't understand your problem.

EMG

Posted: Sun Oct 07, 2007 6:15 pm
by James Bott
Patrick,

It seems you defined them as checkboxes in the RC then redefined them as radios in your code. What that intentional, and if so, why?

James

Posted: Sun Oct 07, 2007 6:54 pm
by Patrick Mast
James Bott wrote:Patrick,

It seems you defined them as checkboxes in the RC then redefined them as radios in your code. What that intentional, and if so, why?
James
Oops, that's a TYPO.. Damned, sorry. But the problem remains, the text of the checkboxes should be RIGHT or LEFT aligned.

Patrick

Re: Checkbox alignment not correct

Posted: Sun Oct 07, 2007 6:55 pm
by Patrick Mast
EnricoMaria wrote:Sorry Patrick but I really don't understand your problem.
EMG
Simple, if I use a checkbox RIGHT aligned (So that the checkbox is on the RIGHT hand side of the text), the text should ALSO e right aligned, and not left.

Patrick

Posted: Sun Oct 07, 2007 7:06 pm
by James Bott
Patrick,

>Simple, if I use a checkbox RIGHT aligned (So that the checkbox is on the RIGHT hand side of the text), the text should ALSO e right aligned, and not left.

You say it "should be" but I am not sure. Is this because this is the way you would like it to be, or because this is the way other Windows apps are showing? Because this is a Windows common control, we are limited as to how it works. Can you show us an example from another application where the checkbox is being displayed the way you think it should be? Or, are all other apps displaying it the same way as FWH?

James

Re: Checkbox alignment not correct

Posted: Sun Oct 07, 2007 8:58 pm
by Enrico Maria Giordano
Patrick Mast wrote:Simple, if I use a checkbox RIGHT aligned (So that the checkbox is on the RIGHT hand side of the text), the text should ALSO e right aligned, and not left.

Patrick
As James suspected, this is not how Windows checkboxes work.

EMG