Page 1 of 1

CheckBox with text aligned to left side

Posted: Thu Nov 03, 2016 11:15 am
by Pablo César
Hi all,

Normally (by default) we have CheckBox texts aligned to the right side of clickable box but when we need to align text to left you can do it changing its style making in this way:

Code: Select all

#include <hmg.ch>

#define BS_LEFTTEXT      0x00000020

Function Main()

DEFINE WINDOW Drives AT 426, 890 WIDTH 288 HEIGHT 166 TITLE "CheckBox Left Text" MAIN

    DEFINE CHECKBOX Check_1
		ROW    30
        COL    30
        WIDTH  210
        HEIGHT 28
        CAPTION " CheckBox with text on the RIGHT"
        VALUE .F.
        FONTNAME "Arial"
        FONTSIZE 9
		FONTBOLD .T.
		BACKCOLOR {180,180,180}
        FONTCOLOR {128,0,0}
		TRANSPARENT .F.
    END CHECKBOX
	
	DEFINE CHECKBOX Check_2
	    ROW    70
        COL    30
        WIDTH  210
        HEIGHT 28
		CAPTION " CheckBox with text on the LEFT"
        VALUE .F.
        FONTNAME "Arial"
        FONTSIZE 9
		FONTBOLD .T.
		BACKCOLOR {180,180,180}
        FONTCOLOR {128,0,0}
		TRANSPARENT .F.
    END CHECKBOX

END WINDOW
Drives.Center

HMG_ChangeWindowStyle ( GetControlHandle("Check_2","Drives"), BS_LEFTTEXT, NIL, .F. ) // LEFTJUSTIFY

Drives.Activate
Return Nil
I hope this would be useful for you. :)
Screen1.png
Screen1.png (14.78 KiB) Viewed 5198 times
Just for fan. :D

Re: CheckBox with text aligned to left side

Posted: Thu Nov 03, 2016 12:16 pm
by mol
Thank you Claudio!
It's useful for me, I was using empty caption of checkbox and label on the left to realize this till now.

This solution should be included in HMG and IDE, I think...

Re: CheckBox with text aligned to left side

Posted: Thu Nov 03, 2016 12:29 pm
by mustafa
Pablo César
Muy Bueno !!!
Saludos
Mustafa

CheckBox with text aligned to left side

Posted: Thu Nov 03, 2016 12:49 pm
by Pablo César
Thank you Mustafa.
mol wrote:Thank you Claudio!
His a good fellow but I'm not... :lol:
mol wrote:It's useful for me, I was using empty caption of checkbox and label on the left to realize this till now.
Good to know being useful. For me it is also sometimes... at the moment I will use for HMG version installed (InstalledAt app) and searching others drives, as Serge has noted.
I imagined that more work to make empty CheckBox and adding Labels, postioning, color, so on...
mol wrote:This solution should be included in HMG and IDE, I think...
Yes it's strange not having in HMG. At HMG Extended, there is LEFTJUSTIFY property which set in that way.

mol

Posted: Thu Nov 03, 2016 3:37 pm
by mol
Pablo César wrote:Thank you Mustafa.
mol wrote:Thank you Claudio!
His a good fellow but I'm not... :lol:
mol wrote:It's useful for me, I was using empty caption of checkbox and label on the left to realize this till now.
Good to know being useful. For me it is also sometimes... at the moment I will use for HMG version installed (InstalledAt app) and searching others drives, as Serge has noted.
I imagined that more work to make empty CheckBox and adding Labels, postioning, color, so on...
mol wrote:This solution should be included in HMG and IDE, I think...
Yes it's strange not having in HMG. At HMG Extended, there is LEFTJUSTIFY property which set in that way.
Sorry Pablo for renaming you for Claudio.... :-D
I have very busy days now.
Thanks again for this solution!

New name

Posted: Thu Nov 03, 2016 3:43 pm
by Pablo César
mol wrote:Sorry Pablo for renaming you for Claudio.... :-D
I have very busy days now.
:lol:
No problem man. It's ok.

Claudio is a gentleman as many here around...

Re: CheckBox with text aligned to left side

Posted: Fri Nov 04, 2016 3:22 pm
by EduardoLuis
Hi Pablo

Very usefull. Thanks for share.-
With regards
Eduardo

Hola Pablo:

Muy util. Gracias por compartirlo.-
Cordialmente
Eduardo

Re: CheckBox with text aligned to left side

Posted: Tue Nov 08, 2016 1:12 am
by quartz565
Thank you Pablo !!!