Purpose Create left-aligned pushbutton texts A pushbutton text is always displayed in the middle of the button by SAP GUI. For certain screens a "left aligned" layout may look better. |
Solution Appending space characters to the pushbutton texts does not alter the text position, but if you append non-breaking space characters ( or   in HTML, U+00A0 in Unicode, 0xC2 0xA0 in UTF-8), you can achieve a left-aligned layout. Since proportional font is used for the pushbuttons there is no simple rule as to how many non-breaking space characters are needed, so you will need a trial and error approach. To insert the non-breaking space characters in the Script Editor Pro you may use the key combination Ctrl+Shift+Space. ![]() Alternative 1 // Attention: non-breaking space characters in pushbutton texts Pushbutton (10,1) "abc " process="xxx.txt" size=(1,16) Pushbutton (11,1) "abc1234 " process="xxx.txt" size=(1,16) Pushbutton (12,1) "abc12345678 " process="xxx.txt" size=(1,16) |
Alternative
2 // Pushbutton texts Set text[pb1] "abc+++++++++++++++++" Set text[pb2] "abc1234++++++++++" Set text[pb3] "abc12345678+++" // Replace + with non-breaking space character in pushbutton texts ReplaceText "pb1" from="+" toHexCode="C2A0" ReplaceText "pb2" from="+" toHexCode="C2A0" ReplaceText "pb3" from="+" toHexCode="C2A0" Pushbutton (10,1) "&text[pb1]" process="xxx.txt" size=(1,16) Pushbutton (11,1) "&text[pb2]" process="xxx.txt" size=(1,16) Pushbutton (12,1) "&text[pb3]" process="xxx.txt" size=(1,16) Alternative 2 (variant) // Pushbutton texts Set text[pb1] "abc++++++++++++++++++++++++++++" Set text[pb2] "abc1234++++++++++++++" Set text[pb3] "abc12345678+" // Replace + with "thin space character" in pushbutton texts ReplaceText "pb1" from="+" toHexCode="E28089" ReplaceText "pb2" from="+" toHexCode="E28089" ReplaceText "pb3" from="+" toHexCode="E28089" Pushbutton (10,1) "&text[pb1]" process="xxx.txt" size=(1,16) Pushbutton (11,1) "&text[pb2]" process="xxx.txt" size=(1,16) Pushbutton (12,1) "&text[pb3]" process="xxx.txt" size=(1,16) |
Components |