| Summary: | Need DojoDialogLib function to prompt user for a string value | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Will Smythe <smythew> | ||||||||||||||
| Component: | EDT | Assignee: | lu lu <lulu> | ||||||||||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||||||||||
| Severity: | enhancement | ||||||||||||||||
| Priority: | P3 | CC: | chenzhh, hjiyong, mayunf, svihovec | ||||||||||||||
| Version: | unspecified | ||||||||||||||||
| Target Milestone: | --- | ||||||||||||||||
| Hardware: | PC | ||||||||||||||||
| OS: | Windows XP | ||||||||||||||||
| Whiteboard: | |||||||||||||||||
| Bug Depends on: | 366284 | ||||||||||||||||
| Bug Blocks: | |||||||||||||||||
| Attachments: |
|
||||||||||||||||
|
Description
Will Smythe
Created attachment 206854 [details]
Prototype code
I did a quick testing of DojoDialogLib.promptForValue in attached file. My callback function did not get the text input. the value argument is a null in callback. I would suggest we put this to 1.0 so that we can have more testing for this. Adding this comment to remind whoever implements this enhancement that it depends on Bug 366284 - Need ability to set arbitrary data on a widget. Created attachment 210774 [details] prompt user with a string value input dialog Hi Will, I add a patch and test it on local env, it has realized that prompt a dialog to input string value, but a bit puzzled with your comment 4, not sure if the implementation can meet the enhancement, can you help to take a look at it? Thanks. Created attachment 210911 [details] Use get/setUserData to replace get/setAttributes and array Use get/setUserData to replace set/getAttributes and arrays. And this enh depends on another bug 371333. Reviewed and committed. Ji Yong has helped to review and deliver this enh, Thanks. Mark this enh as resolved. Reopening. The Cancel button behaves identically to the OK button, meaning the value in the prompt field is passed to the callback function regardless if OK or Cancel is clicked. One idea is to allow the string value in the delegate to be declared as nullable. If the user presses Cancel, the callback will get called, but the value will be null. E.g. delegate promptSupplied(value String? in, e Event in) returns (boolean) .. and then add code in DojoDialogLib.promptButtonClick to handle the case where the Cancel button is clicked: callback promptSupplied = promptField.getUserData(); if (buttonDict.functionId == ID_CANCEL) hide = callback(null, e); else hide = callback(promptField.text, e); end I made the change and confirmed it works. See attached file. I also made a few other, necessary changes: 1) Pressing ENTER or ESC triggers the OK and Cancel buttons, respectively 2) Made the "title" variable nullable in the function declaration for the various "showXXX" functions. This will save the developer for calling RuiLib.getTitle() themselves 3) Fixed broken image links (this has probably been broken for awhile) Deferring to I3 for final resolution. Created attachment 211340 [details]
Updated DojoDialogLib with fixes
Created attachment 211390 [details]
Provide more functions and cope with cancel action
Hi Will,
I tested the changes in local env, I assume if we should enlarge the influence when Press ENTER or ESC buttons, otherwise, those hot keys can be triggered only if focus on prompt field, so move OnKeyDown event to table widget, like this:
*****************************************************************************
From: promptField DojoTextField { width = "300px", style = "max-width: 500px", onKeyDown ::= promptFieldKeyDown };
To: table Widget { tagName = "table", children = [ body ], style = "max-width: 500px", onKeyDown ::= tableKeyDown };
*****************************************************************************
I attach the patch, please help to review. Thanks.
Has been tested on IE/Chrome/FF. Hi JiYong, Can you help to commit this? Thanks. Created attachment 211718 [details]
Refine based on the latest version
Committed Done. Thanks. close |