Page 1 of 1

TButton Icon Alignment

Posted: Thu Jul 23, 2020 7:57 pm
by Rick Lipkin
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

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()
 

Re: TButton Icon Alignment

Posted: Mon Jul 27, 2020 12:29 pm
by Rick Lipkin
Any news ??

Thanks
Rick Lipkin

Re: TButton Icon Alignment

Posted: Mon Jul 27, 2020 4:53 pm
by nageswaragunupudi
For the purpose of testing, can you change the prompt as "abc" (shorter text) ?

Re: TButton Icon Alignment

Posted: Tue Jul 28, 2020 12:55 pm
by Rick Lipkin
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

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

Re: TButton Icon Alignment

Posted: Tue Jul 28, 2020 5:02 pm
by nageswaragunupudi
Then you need to increase the width of the buttons to provide enough room to accommodate both bitmap and the prompt.

Re: TButton Icon Alignment

Posted: Wed Jul 29, 2020 1:33 pm
by Rick Lipkin
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

Re: TButton Icon Alignment

Posted: Wed Jul 29, 2020 2:16 pm
by nageswaragunupudi
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.