CheckBox with text aligned to left side

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

CheckBox with text aligned to left side

Post 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 5068 times
Just for fan. :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: CheckBox with text aligned to left side

Post 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...
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: CheckBox with text aligned to left side

Post by mustafa »

Pablo César
Muy Bueno !!!
Saludos
Mustafa
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

CheckBox with text aligned to left side

Post 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.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

mol

Post 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!
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

New name

Post 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...
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: CheckBox with text aligned to left side

Post by EduardoLuis »

Hi Pablo

Very usefull. Thanks for share.-
With regards
Eduardo

Hola Pablo:

Muy util. Gracias por compartirlo.-
Cordialmente
Eduardo
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Re: CheckBox with text aligned to left side

Post by quartz565 »

Thank you Pablo !!!
Best Regards,
Nikos.

os: Windows Server 2019 - 64
Post Reply