Checkbox alignment not correct

Post Reply
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Checkbox alignment not correct

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Checkbox alignment not correct

Post 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
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Re: Checkbox alignment not correct

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Post 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
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Re: Checkbox alignment not correct

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Checkbox alignment not correct

Post 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
Post Reply