Sub TestInputBox
Wait For(InputBox2("", "Title Test", "Hint test", "Default Test", _
Colors.RGB(0, 0, 160), Colors.RGB(128,128, 128), 0, Null, General.bmpIcon32, True, -1)) _
Complete (strResult As String)
General.ShowMsg(strResult, "Inputbox test", 0, 0, Null, General.bmpIcon32, True)
End Sub
Sub fledtInputbox_TextChanged (Old As String, New As String)
If fledtInputbox.IsInitialized Then
Input_Dialog.GetButton(DialogResponse.POSITIVE).Enabled = fledtInputbox.Text.Length > 0
End If
End Sub
Sub InputBox2(strPrompt As String, _
strTitle As String, _
strHint As String, _
strDefault As String, _
iPromptColour As Int, _
iHintColour As Int, _
iInputColour As Int, _
csPrompt As CSBuilder, _
bmpIcon As Bitmap, _
bCancelable As Boolean, _
iPromptHeight As Int) As ResumableSub
Dim csPrompt As CSBuilder
If iPromptColour = 0 Then
iPromptColour = Colors.RGB(0, 0, 0)
End If
If iHintColour = 0 Then
iHintColour = Colors.RGB(0, 0, 0)
End If
If iInputColour = 0 Then
iInputColour = Colors.RGB(0, 0, 0)
End If
If csPrompt.IsInitialized = False Then
csPrompt.Initialize.Size(16).Color(iPromptColour).Append(strPrompt).PopAll
End If
Dim sf As Object = Input_Dialog.ShowAsync(strTitle, "OK", "Cancel", "", bmpIcon, bCancelable)
Wait For (sf) Dialog_Ready(pnl As Panel)
pnl.LoadLayout("Input_Dialog")
fledtInputbox.Hint = strHint
fledtInputbox.EditText.TextColor = iInputColour
fledtInputbox.EditText.HintColor = iHintColour
'as we have the hint, no prompt label may be needed
If strPrompt.Length > 0 Then
If iPromptHeight = -1 Then
lblInputBox.Height = sUtils.MeasureMultilineTextHeight(lblInputBox, csPrompt)
Else
'not sure we need this option, MeasureMultilineTextHeight seems to work well
lblInputBox.Height = iPromptHeight
End If
General.RunLog("InputBox2, lblInputBox.Height: " & lblInputBox.Height)
Input_Dialog.SetSize(90%x, lblInputBox.Height + 200dip)
lblInputBox.Text = csPrompt
Else
Input_Dialog.SetSize(90%x, 200dip)
lblInputBox.Visible = False
End If
If strDefault.Length > 0 Then
fledtInputbox.Text = strDefault
End If
Wait For (sf) Dialog_Result(res As Int)
If res = DialogResponse.POSITIVE Then
Return fledtInputbox.text 'OK button
Else
Return "" 'Cancel button
End If
End Sub