TButton Icon Alignment

TButton Icon Alignment

Postby Rick Lipkin » Thu Jul 23, 2020 7:57 pm

To All

I have 4 identical sized TButtons 52 x 20 that each have a 16 bit icon .. I can not ( further ) change the width of the Button Prompts ..

Image

Notice how the second button Icon is out of alignment .. Here is the code .. I realize the length of the Prompt is longer than the other 3 and seems to push the icon farther left .. There is plenty of room if there was a way to insert a space to right pad the icon to line up all 4 icons ..

Please note that I continue to widen the button with very little changes in the calculation placement of the icon .. any help would be appreciated.

Thanks
Rick Lipkin

Code: Select all  Expand view  RUN

REDEFINE BTNBMP oBtn2 ID 252 OF oGrps   ;
         RESOURCE "COMMENT" ;
         PROMPT "Comment" LEFT 2007;
         ACTION ( _ViewMemo2( cMode, oRsTrav, "Request",oBtn1,oBtn2,oBtn3,oBtn4,oBtn5, "2" ,@cComments, 400, cPrevAppr, oFontb ),LightGreyGrad());
         GRADIENT GreyButtonGrad()
 
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TButton Icon Alignment

Postby Rick Lipkin » Mon Jul 27, 2020 12:29 pm

Any news ??

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TButton Icon Alignment

Postby nageswaragunupudi » Mon Jul 27, 2020 4:53 pm

For the purpose of testing, can you change the prompt as "abc" (shorter text) ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10650
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TButton Icon Alignment

Postby Rick Lipkin » Tue Jul 28, 2020 12:55 pm

Rao

Using a fixed length Prompt "Abc" does make all the button icons line up correctly .. unfortunitly, not all captions will have the same length...

Image

It would be nice if you could add a space before the Resource to be able to force the icon to the right to correct the spacing when needed ..

Code: Select all  Expand view  RUN

REDEFINE BTNBMP oBtn2 ID 252 OF oGrps   ;
         RESOURCE space(1)+"COMMENT" ;
         PROMPT "Comment" LEFT 2007;
         ACTION ( _ViewMemo2( cMode, oRsTrav, "Request",oBtn1,oBtn2,oBtn3,oBtn4,oBtn5, "2" ,@cComments, 400, cPrevAppr, oFontb ),LightGreyGrad());
         GRADIENT GreyButtonGrad()
 


Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TButton Icon Alignment

Postby nageswaragunupudi » Tue Jul 28, 2020 5:02 pm

Then you need to increase the width of the buttons to provide enough room to accommodate both bitmap and the prompt.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10650
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TButton Icon Alignment

Postby Rick Lipkin » Wed Jul 29, 2020 1:33 pm

Rao

I realized that .. was hoping for another possible solution .. This form is quite complex and there is just no room to enlarge the buttons ....

Image

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TButton Icon Alignment

Postby nageswaragunupudi » Wed Jul 29, 2020 2:16 pm

Try specifying oBtn:aBmpRect := { t, l, b, r } in pixels.
Then bitmap will be positioned inside the specified rectangle.
Specify the same rect to all the buttons.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10650
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 62 guests