Currently use this code for a simple inputbox dialog. It uses the Dialogs library, version 4.01:
This works all fine, but I need to apply some formatting to the prompt text and for that I would like
to use CSBuilder. The dialogs library doesn't accept Charsequence input though. I want to keep it simple,
so ideally without adding a lot of extra code. So, something along these lines for a simple Msgbox:
Any suggestions what the best/simplest way would be?
RBS
B4X:
Sub InputBox(Prompt As String, Title As String, Default As String, Hint As String) As String
Dim Id As InputDialog
Dim iRet As Int
Id.Hint = Hint
Id.Input = Default
iRet = Id.Show(Prompt, Title, "OK", "", "Cancel", General.bmpIcon32)
If iRet = -1 Then
Return Id.Input
Else
Return ""
End If
End Sub
This works all fine, but I need to apply some formatting to the prompt text and for that I would like
to use CSBuilder. The dialogs library doesn't accept Charsequence input though. I want to keep it simple,
so ideally without adding a lot of extra code. So, something along these lines for a simple Msgbox:
B4X:
Public Sub ShowMsg(strPrompt As String, _
strTitle As String, _
iTitleColour As Int, _
iPromptColour As Int, _
csPrompt As CSBuilder, _
bmpIcon As Bitmap, _
bCancelable As Boolean)
Dim csTitle As CSBuilder
'so like optional colour argument
If iTitleColour = 0 Then
iTitleColour = Colors.RGB(0, 0, 0)
End If
If iPromptColour = 0 Then
iPromptColour = Colors.RGB(0, 0, 0)
End If
csTitle.Initialize.Color(iTitleColour).Append(strTitle).Pop
'so csPrompt is like an optional argument, passing Null works fine
If csPrompt.IsInitialized = False Then
csPrompt.Initialize.Color(iPromptColour).Append(strPrompt).Pop
End If
'can pass Null for no icon
Msgbox2Async(csPrompt, csTitle, "OK", "", "", bmpIcon, bCancelable)
End Sub
Any suggestions what the best/simplest way would be?
RBS