![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Multiple Buttons with one Callback function? Topic Summary: Created On: 6-Oct-2004 00:06 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Hi, Shawn. Use '==' for the condition: // switchButton.dxl DB db = null DBE btn1, btn2, btn3 void cbButtons(DBE dbe) { if (dbe == btn1) then print "Button 1 pushed\n" else if (dbe == btn2) then print "Button 2 pushed\n" else if (dbe == btn3) then print "Button 3 pushed\n" } // main. db = create("Buttontest") btn1 = button(db, "Button", cbButtons) btn2 = button(db, "Button", cbButtons) btn3 = button(db, "Button", cbButtons) show(db) Dirk. | |
![]() |
|
How can I specify a single callback function for multiple buttons? The callback is passed a DBE object, but how can I find out which one was clicked? I tried:
if (passedDBE = globalDBE) but that was unacceptable. I tried: string whichOne = get(passedDBE) but that didn't work either. Note: All of the buttons have the same text on them. I know I could specify a different callback function for each, but that would be pretty ugly. ![]() ------------------------- Shawn Stepper shawn.e.stepper@wellsfargo.com |
|
![]() |
|
![]() |
|
DBE's don't have retrievable ID's.
is the following too ugly? int iCB void CB_generic(DBE x) { .... .... if(iCB == 1) { ....etc } } void CB1(DBE x) { iCB = 1 CB_generic(x) } void CB2(DBE x) { iCB = 2 CB_generic(x) } void CB3(DBE x) { iCB = 3 CB_generic(x) } |
|
![]() |
|
![]() |
|
Hi, Shawn.
Use '==' for the condition: // switchButton.dxl DB db = null DBE btn1, btn2, btn3 void cbButtons(DBE dbe) { if (dbe == btn1) then print "Button 1 pushed\n" else if (dbe == btn2) then print "Button 2 pushed\n" else if (dbe == btn3) then print "Button 3 pushed\n" } // main. db = create("Buttontest") btn1 = button(db, "Button", cbButtons) btn2 = button(db, "Button", cbButtons) btn3 = button(db, "Button", cbButtons) show(db) Dirk. ------------------------- Dirk Plaschke |
|
![]() |
|
![]() |
|
OK now I feel lame. Must have been the VB scripting I was doing.
![]() ------------------------- Shawn Stepper shawn.e.stepper@wellsfargo.com |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Multiple Buttons with one Callback function?
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.