![]() |
Telelogic DOORS (steve huntington) | ![]() |
Topic Title: Dialog Boxes - Conditional logic to select "block" in some cases and "show" in others Topic Summary: Created On: 15-Jan-2009 17:36 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Ron, I cannot thank you enough. This worked like a charm!!!! Thank you so much. Regards, Pranav | |
![]() |
|
The situation I want to highlight relates to dialog boxes in DXL. I have a dialog box with an "OK" button and "close" button. Clicking each of these buttons triggers separate functions. My dialog box is called "selectDate" and the lines of code that define its action are shown below:
ok (selectDate, "OK", fromList) close(selectDate,true,getOut) realize selectDate setCenteredSize (selectDate, 350,170) show selectDate When I run this code, as soon as I click on the "OK" button, the function that it triggers (i.e. the "fromList" function) is run and then the program exits completely without performing any additional functions. This behavior is UNDESIRABLE for the script. When I click on the "close" button, the program executes the "getOut" function and exits from the program (this is desirable behavior of the script). I modified the code snippet above. The result is below: ok (selectDate, "OK", fromList) close(selectDate,true,getOut) realize selectDate setCenteredSize (selectDate, 350,170) block selectDate When I run this code, as soon as I click on the "OK" button, the "fromList" function is triggered and the rest of the functions in the program also execute. This behavior is desirable. Unfortunately, when I click on the "close" button, the program executes the "getOut" function BUT THEN LOCKS DOORS completely!!! Is there anyway to set up a conditional logic that triggers the "show" action in cases where the "close" button is clicked on and "block" action in cases where the "OK" button is clicked on? I absolutely need to resolve this situation. Any input would be appreciated. Thank you. Regards, Pranav |
|
![]() |
|
![]() |
|
Your building a rats nets of code if you progress the way you are going.
A well structure program usually relies on a show function however you have to structure the script to have all executables code prior to show. (ie., show is the last statement executed.) When I get lazy, I use the following method. (i.e., the dxl is going to be a throw away and I don't want to spend lots of time on the script.) // preliminary code bool bCancel = true //Variable use to halt or continue execution. voir runCB(DB x) { bCancel =false //additional code } ok(mainDB, "Run", runCB) block mainDB if (bCancel) halt // halts if you hit cancel //additional code to run after clicking ok Edited: 15-Jan-2009 at 19:59 by ron lewis |
|
![]() |
|
![]() |
|
Ron,
I cannot thank you enough. This worked like a charm!!!! Thank you so much. Regards, Pranav |
|
![]() |
|
![]() |
|
Pranav,
can you let us see your getOut function? does it destroy the dialogue before closing and do all the tidy ups of open items? I'm sure there should be a more elegant solution then using the halt as Ron shows, using dialogues can be a bit of a minefield so some careful thought is handy upfront if this is a long term project. If it's a quick hack then ignore me and use Ron's solution! Graham ------------------------- Graham Stradling, Alcatel-Lucent. |
|
![]() |
|
![]() |
|
Hi Graham,
I ended up using Ron's approach and it worked like a charm. I still have the "getOut" function though. The code for this function is below: void getOut(DB enterFile) { //This function is typically triggered by the "Close" // button. If a user selects an option and changes his or // her mind about executing the option, clicking // on the "close" button will help him or her exit the //overall script execution process hide(enterFile) hide(mainMenu) halt }//end of getOut I hope this helps. Thanks. Pranav |
|
![]() |
|
![]() |
|
Lewis' solution looks good. Another solution is to use a query box with two buttons ["OK", "Close"], where OK returns code 0 and Close returns code 1. Then look at the code to determine what you want to do. May look something like attached.
- Louie PS: Its customary to mark the responder's post as the Anser, not the post where you thank them. Edited: 20-Jan-2009 at 23:06 by Louie Landale |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.