I have a Class that generates a color picker dialog with several sliders and buttons (Save, Cancel, Reset)
I want to return an Integer value from calling the SHOW routine.
This works but I don't like it. It basically spins until the user presses one of the three buttons which changes the value of ColorSelected from False to True.
I know that I could do a CallBack but that seems more complex than simply returning an Int value.
My gut tells me this is a bad solution but perhaps I'm wrong. I've looked for other examples of providing a return value from a GUI class but have not found one.
Any opinions from someone with a bit more experience would be welcome. I'd class myself as advanced beginner.
After some reading it seems that what I'm looking for is advice on creating a Modal Dialog. Sounds like it should be easy but apparently that is not the case.
I want to return an Integer value from calling the SHOW routine.
B4X:
Public Sub Show() As Int
lblTitle.Text = Title
pnlColor.Visible = True
Update_Current_Color
Do While True
'DoEvents
If ColorSelected = True Then
Return NewColor
Else
WaitFewSeconds(500)
Update_Current_Color
End If
Loop
End Sub
This works but I don't like it. It basically spins until the user presses one of the three buttons which changes the value of ColorSelected from False to True.
I know that I could do a CallBack but that seems more complex than simply returning an Int value.
My gut tells me this is a bad solution but perhaps I'm wrong. I've looked for other examples of providing a return value from a GUI class but have not found one.
Any opinions from someone with a bit more experience would be welcome. I'd class myself as advanced beginner.
After some reading it seems that what I'm looking for is advice on creating a Modal Dialog. Sounds like it should be easy but apparently that is not the case.
Last edited: