I want to show _Save as text in a button control (actually the underscore should appear under the character "S" instead of preceding it. how to achieve it ?
Set the button text to "_Save"
then using javaobject set MnemonicParsing to true for the button
B4X:
dim b as Button
...
b.initialize("but1")
b.text = "_Save"
asJO(b).RunMethod("setMnemonicParsing",array(true))
...
sub asJO(o as JavaObject) as JavaObject
return o
end sub
...
sub but1_Action
' now ALT+S will also call this routine as well as a click on the button
...
end sub
...
Set the button text to "_Save"
then using javaobject set MnemonicParsing to true for the button
B4X:
dim b as Button
...
b.initialize("but1")
b.text = "_Save"
asJO(b).RunMethod("setMnemonicParsing",array(true))
...
sub asJO(o as JavaObject) as JavaObject
return o
end sub
...
sub but1_Action
' now ALT+S will also call this routine as well as a click on the button
...
end sub
...
@Daestrum
Thanks for the code. It works. However the underscore character appears only if you press ALT once and remains after that forever. It does not appear automatically when the form is displayed.
How to make it appear without pressing ALT key?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.