InputRequester - How do I distinguish between "Cancel" and entering an empty string?
Re: InputRequester - How do I distinguish between "Cancel" and entering an empty string?
With default string ?!
Code: Select all
Value.s = "Default"
s1.s = InputRequester("Input", "Text", Value)
If s1 = Value
Debug "Not Change"
ElseIf S1 = ""
Debug "Empty"
Else
Debug "Input: " + s1
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: InputRequester - How do I distinguish between "Cancel" and entering an empty string?
Depends on your needs. In my app, the user can hit Esc to cancel the prompt; or enter some new text for it; or select and delete the existing default text to indicate that no text should be used. You can't use InputRequester() to distinguish between all three cases, so I needed to roll my own solution.
Re: InputRequester - How do I distinguish between "Cancel" and entering an empty string?
Only problem with this approach is that the text isn't selected by default, so I have to explicitly select all and delete "default" before I can type what I want.mk-soft wrote: Thu Nov 30, 2023 10:43 am With default string ?!Code: Select all
Value.s = "Default" s1.s = InputRequester("Input", "Text", Value) If s1 = Value Debug "Not Change" ElseIf S1 = "" Debug "Empty" Else Debug "Input: " + s1 EndIf

