More confusion. Working through the ToDoList example in the documentation it states: you want to set AddButtons Default property to true; that way, a user can add an item to the list simply by pressing Enter or Return.
From the Xojo documentation:
aPushButton.Default = newBooleanValue
or
BooleanValue = aPushButton.Default
Supported for all project types and targets.
Sample Code
This code sets the PushButton as the default button. It is in the Open event of the control.
Me.Default = True
The question is: Where do you do this??
Tried in the AddButton Action and get an error. Tried in AddButton Open and get an error.
Type “WebButton” has no member named “Default”
AddButton.Default = True
Well, that is true. But the documentation is giving an example of a WebButton. If I go to the WebButton Documentation I see it only has an auto disable property. I can play with that in the WebButton (named AddButton) action with Me.AutoDisable = False or
Me.AutoDisable = True, and I see what it does, but there does not seem to be a way to do what the documentation suggests: you want to set AddButtons Default property to true; that way, a user can add an item to the list simply by pressing Enter or Return.
Which documentation? The PushButton documentation clearly states it is only for Desktop project types, and for web apps to see WebButton (which itself clearly states it is for web apps, and for desktop app to use PushButton).
You can see that desktop app have lots more properties available, including Default and Cancel, then the WebButton which is more limited due to browser constraints compared to a desktop OS native control.
But I don’t see the text from your original message in the current PushButton documentation either, so I’m curious where you found it. Sounds to be like it could have been from some guide talking about desktop applications instead of web apps?
The documentation is this: Introduction to Programming with Xojo.pdf which can be downloaded from the Xojo Help menu in the Xojo Application
It starts with this (page 86):
If you havent already done so, launch Xojo and create a new
Web Application. Save it as ToDoList. [notice it says Web Application]
It says to create this (page 86):
Control Name Caption
WebButton AddButton Add [notice it says WebButton]
On pages 86-87 it says this:
To make data entry more e?cient for your end user, you want to set AddButtons Default property to true; that way, a user can add an item to the list simply by pressing Enter or Return.
That would be a really nice thing to do, but I do not see how to accomplish it - for the reasons I and others have described.
[quote=458130:@Brad Logan]The documentation is this: Introduction to Programming with Xojo.pdf which can be downloaded from the Xojo Help menu in the Xojo Application
[/quote]
Which version of Xojo are you using ?
IF you happen to be using the very latest understand that in this version they changed the names of a LOT of things so the PDF is now out of date and will tell you, like this, to set things that now have different names.
I dont think that PDF has been updated with all the new names yet
The latest version 2018 r 4… Thanks for letting me know. Does anyone know what code is now required to make a webButton default to accept a return as input?
I don’t see this in the current version of the Introduction to Programming book (4th Edtion) that was posted when 2019r2 was released on Oct 9, so it must have been corrected.
There’s not really a good way to do this in Xojo web at the moment. You could check the WebTextField.KeyPressed event to see if return was pressed and then add the text yourself, but sending keypresses through a web app like that is not efficient.
Bad timing on my part. A few days ago I downloaded the Introduction manual and I see that I got v 1.3. It now downloads v 1.4. Bad timing on my part, but there was no way for me to know the manual version changed. It might be an idea for the maintainers of the Xojo app to put a version number on the help menu so it reads Introduction to Programming v 1.4 10/9/19 and to put that on the title page of the manual that is downloaded. Just a thought.
[quote=458499:@Paul Lefebvre]I don’t see this in the current version of the Introduction to Programming book (4th Edtion) that was posted when 2019r2 was released on Oct 9, so it must have been corrected.
https://www.xojo.com/learn
[/quote]
Weird, tried to download the book (4th Edition) but always got the 3rd Edition. Tried with Chrome, Safari, Firefox and even in incognito/private mode.