A Allan Cameron Member Licensed User Longtime User Dec 10, 2014 #1 Erel--How do I set the button text color in code? There does not seem to be a .TextColor setting. Also, is there a way to have multi-line text on a button? Thanks Allan
Erel--How do I set the button text color in code? There does not seem to be a .TextColor setting. Also, is there a way to have multi-line text on a button? Thanks Allan
Erel B4X founder Staff member Licensed User Longtime User Dec 11, 2014 #2 Note that this is not a private forum. Don't limit your questions to a single member. See this thread: https://www.b4x.com/android/forum/threads/button-textcolor.47640/#post-295034 You can use this code to set the button to show multiple lines: B4X: Expand Collapse Copy Sub SetMultiline(b As Button) Dim no As NativeObject = b no.GetField("titleLabel").SetField("numberOfLines", 0) End Sub Upvote 0
Note that this is not a private forum. Don't limit your questions to a single member. See this thread: https://www.b4x.com/android/forum/threads/button-textcolor.47640/#post-295034 You can use this code to set the button to show multiple lines: B4X: Expand Collapse Copy Sub SetMultiline(b As Button) Dim no As NativeObject = b no.GetField("titleLabel").SetField("numberOfLines", 0) End Sub
A Allan Cameron Member Licensed User Longtime User Dec 11, 2014 #3 Thanks, is there a way to center multiline text on a button? Upvote 0
A Allan Cameron Member Licensed User Longtime User Dec 11, 2014 #5 Sorry, Erel, for not being clear, vertically and horizontally. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 11, 2014 #6 It should be centered by default: Upvote 0
A Allan Cameron Member Licensed User Longtime User Dec 11, 2014 #7 Erel--Thanks again for your help. I have been putting labels of different lengths on buttons (in different languages) and this has sorted out the problem I was experiencing. Upvote 0
Erel--Thanks again for your help. I have been putting labels of different lengths on buttons (in different languages) and this has sorted out the problem I was experiencing.
D Deleted member 103 Guest Dec 31, 2014 #8 Erel said: Note that this is not a private forum. Don't limit your questions to a single member. See this thread: https://www.b4x.com/android/forum/threads/button-textcolor.47640/#post-295034 You can use this code to set the button to show multiple lines: B4X: Expand Collapse Copy Sub SetMultiline(b As Button) Dim no As NativeObject = b no.GetField("titleLabel").SetField("numberOfLines", 0) End Sub Click to expand... TextAlignment=ALIGNMENT_CENTER B4X: Expand Collapse Copy Sub SetMultiline(b As Button) Dim no As NativeObject = b no.GetField("titleLabel").SetField("numberOfLines", 0) no.GetField("titleLabel").SetField("textAlignment", 1) End Sub Declaration Objective-C enum { NSTextAlignmentLeft = 0, NSTextAlignmentCenter = 1, NSTextAlignmentRight = 2, NSTextAlignmentJustified = 3, NSTextAlignmentNatural = 4, }; typedef NSInteger NSTextAlignment; Click to expand... Upvote 0
Erel said: Note that this is not a private forum. Don't limit your questions to a single member. See this thread: https://www.b4x.com/android/forum/threads/button-textcolor.47640/#post-295034 You can use this code to set the button to show multiple lines: B4X: Expand Collapse Copy Sub SetMultiline(b As Button) Dim no As NativeObject = b no.GetField("titleLabel").SetField("numberOfLines", 0) End Sub Click to expand... TextAlignment=ALIGNMENT_CENTER B4X: Expand Collapse Copy Sub SetMultiline(b As Button) Dim no As NativeObject = b no.GetField("titleLabel").SetField("numberOfLines", 0) no.GetField("titleLabel").SetField("textAlignment", 1) End Sub Declaration Objective-C enum { NSTextAlignmentLeft = 0, NSTextAlignmentCenter = 1, NSTextAlignmentRight = 2, NSTextAlignmentJustified = 3, NSTextAlignmentNatural = 4, }; typedef NSInteger NSTextAlignment; Click to expand...