Inputbox equivalent?

Hello

Is there an inputbox equivalent from .Net in Xojo?
Couldn’t find it in the docs.

Thanks

Not that I’m aware of. It’s easy enough to create though. Create a window named winAskOne with a type of modal or sheet dialog and add this method in it:

[code]Function AskOne(Instructions as string, byref initialValue as String) As boolean
stInstructions.text = Instructions
txtValue.text = initialValue
txtValue.SelectAll
txtValue.SetFocus

self.ShowModal

if bReturnValue then
initialValue = txtValue.text
end

return bReturnValue //True if user pressed OK, false if they pressed cancel
End Function
[/code]

Then to invoke you just do this:
dim w as new winAskOne
if w.AskOne(“These are my instructions. Type something.”, sInitialValue) then
//User pressed ok. Do what you need here.
else
//User cancelled. Do what you need here.
end

We have a 15 minute training video (along with full project code) called “Returning a Value From a Window” for subscribers at http://www.bkeeney.com/XojoTraining/xojotraining.cgi

Thanks, is indeed not hard to do. But I assumed there was something build in.

There isn’t
It’s pretty darned simple and usually makes for a not very pleasing UI in the long run (like using Msgbox for a lot of interaction with a user - it’s ok in a few small places but I would not use it widely in code shipped to anyone)

[quote=69455:@Bob Keeney]Not that I’m aware of. It’s easy enough to create though. Create a window named winAskOne with a type of modal or sheet dialog and add this method in it:

[code]Function AskOne(Instructions as string, byref initialValue as String) As boolean
stInstructions.text = Instructions
txtValue.text = initialValue
txtValue.SelectAll
txtValue.SetFocus

self.ShowModal

if bReturnValue then
initialValue = txtValue.text
end

return bReturnValue //True if user pressed OK, false if they pressed cancel
End Function
[/code]

Then to invoke you just do this:
dim w as new winAskOne
if w.AskOne(“These are my instructions. Type something.”, sInitialValue) then
//User pressed ok. Do what you need here.
else
//User cancelled. Do what you need here.
end

We have a 15 minute training video (along with full project code) called “Returning a Value From a Window” for subscribers at http://www.bkeeney.com/XojoTraining/xojotraining.cgi[/quote]

One little question, bReturnValue, how changes that in this proces?

The buttons on the dialog. OK/Save button sets it to true. Cancel makes it false. Both buttons set the window.visible property to false.

Here is an example of how I do it

inputwin

Thanks Mr Keeney and Mr Schneider