EWL UserPrompt [message #1017765] |
Tue, 12 March 2013 13:54 |
serhat gezgin Messages: 243 Registered: January 2013 Location: Izmir |
Senior Member |
|
|
Hi,
I want to model refactoring using ewl.
But i can't find ewl libraries.
for example i want to use UserPromt but dont know what kind of userPromt available with ewl.
So where can i find this informations. anyone can help me
i use from epsilon book;
var newName : String;
var message : String := "Please provide a name for the file";
newName := UserInput.prompt(message, self.name);
newName.println();
But when i cancel the prompt from model i always get String value how can i understand when user click to cancel button on prompt ?
regards
[Updated on: Tue, 12 March 2013 19:09] Report message to a moderator
|
|
|
Re: EWL UserPrompt [message #1018320 is a reply to message #1017765] |
Wed, 13 March 2013 15:58 |
|
Have you tried checking if its value is defined?
var newName : String;
var message : String := "Please provide a name for the file";
newName := UserInput.prompt(message, self.name);
if (newName.isDefined()) {
// user hit OK
}
newName.println();
|
|
|
|
Re: EWL UserPrompt [message #1019023 is a reply to message #1018393] |
Thu, 14 March 2013 22:42 |
|
It seems this particular behaviour is by design. Consider this paragraph from the Epsilon book (section 3.7, "Context-independent User Input"):
Quote:
As displayed above, all the methods of the IUserInput interface accept a default pa-
rameter. The purpose of this parameter is dual. First, it enables the designer of the model management program to prompt the user with the most likely value as a default choice and secondly it enables a concrete implementation of the interface UnattendedExecutionUserInput) which returns the default values without prompting the user at all and thus, can be used for unattended execution of interactive Epsilon programs.
If you want to detect that the user hit Cancel, I would suggest using an invalid default value and compare against that.
If that doesn't work out for you, please file a bug request and we'll look into it. I'm not sure if there may be some EOL code out there relying on this particular behaviour, and we wouldn't really want to break it unless necessary.
|
|
|
|
Re: EWL UserPrompt [message #1019259 is a reply to message #1019167] |
Fri, 15 March 2013 10:31 |
|
That's because the default value is intended to be used when the script is used from a non-interactive environment (e.g. an Ant task).
If you need the interactive IUserInput implementations to return null instead of the default value, please file a bug report and we'll look into it.
|
|
|
Powered by
FUDForum. Page generated in 0.05296 seconds