stingrae Active Member Licensed User Longtime User Feb 12, 2019 #1 Hi, I'm using the function below to set the Text Colour of a button. But I can't seem to figure out how to re-engineer it to Get the text button's colour. (basically I want to set Button1's TextColor property to be the same as Button2) Can someone help me out please? Code: Copy Sub SetButtonTextColor(btn As Button, clr As Int, state As Int) ' state: 0 = normal, 1 = pressed, 2 = disabled Dim no As NativeObject = btn no.RunMethod("setTitleColor:forState:", Array(no.ColorToUIColor(clr), state)) End Sub
Hi, I'm using the function below to set the Text Colour of a button. But I can't seem to figure out how to re-engineer it to Get the text button's colour. (basically I want to set Button1's TextColor property to be the same as Button2) Can someone help me out please? Code: Copy Sub SetButtonTextColor(btn As Button, clr As Int, state As Int) ' state: 0 = normal, 1 = pressed, 2 = disabled Dim no As NativeObject = btn no.RunMethod("setTitleColor:forState:", Array(no.ColorToUIColor(clr), state)) End Sub
Erel B4X founder Staff member Licensed User Longtime User Feb 12, 2019 #2 Untested code: Code: Copy Sub GetButtonTextColor(btn As Button, State As Int) As Int ' state: 0 = normal, 1 = pressed, 2 = disabled Dim no As NativeObject = btn Return no.UIColorToColor(no.RunMethod("titleColorForState:", Array(state))) End Sub Upvote 0
Untested code: Code: Copy Sub GetButtonTextColor(btn As Button, State As Int) As Int ' state: 0 = normal, 1 = pressed, 2 = disabled Dim no As NativeObject = btn Return no.UIColorToColor(no.RunMethod("titleColorForState:", Array(state))) End Sub
stingrae Active Member Licensed User Longtime User Feb 12, 2019 #3 Worked PERFECTLY Thank you Upvote 0