Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Pranav Chandrasekhar, on Thursday, January 15, 2009 9:01 PM

Answer:
Ron,
I cannot thank you enough. This worked like a charm!!!! Thank you so much.

Regards,

Pranav
 15-Jan-2009 17:36
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

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
Report this to a Moderator Report this to a Moderator
 15-Jan-2009 17:46
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

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
Report this to a Moderator Report this to a Moderator
 15-Jan-2009 21:01
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

Answer Answer
Ron,
I cannot thank you enough. This worked like a charm!!!! Thank you so much.

Regards,

Pranav
Report this to a Moderator Report this to a Moderator
 20-Jan-2009 18:37
User is offline View Users Profile Print this message


Graham Stradling

Posts: 67
Joined: 19-Sep-2002

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.
Report this to a Moderator Report this to a Moderator
 20-Jan-2009 18:49
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

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
Report this to a Moderator Report this to a Moderator
 20-Jan-2009 23:05
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.