Difference between block() and show()

What is the difference between

void block(DB box)

and

void show(DB box)

?
Is 'show()' a 'block() + halt()' or is there another (hidden) feature?


thsturm - Tue Nov 23 09:32:14 EST 2010

Re: Difference between block() and show()
llandale - Tue Nov 23 14:34:23 EST 2010

The 'block' displays a 'modal' box which MUST be disposed before you can do anything else in DOORS. Typical 'ack' boxes are 'modal', you must say [OK] to unlock the rest of the interface. The 'show' displays a normal dialog which does NOT prevent interaction with the rest of DOORS. When you 'show' a dialog, the user can still navigate in the module. There are some things that must be done after a dialog is 'realized' and before is it 'show'n or 'block'd.

Nothing executes after a 'show', all processing is done with callbacks, buttons, or applys. You should therefore take care to closeOutDB() (see below) inside your 'applyClose(DB)' function associated with the dialog.
Code indeed executes after the 'block' command once the dialog is 'released', again inside some callback, button, or apply. Don't have much experience with 'block' and hopefully someone with more experience will correct me, but I believe the following should be routine for modal dialogs:

[1] Your various callback/button/apply functions should simply 'release(db)' as the last thing they do, if they want to close the dialog.
[2] Any applyClose() you write should likewise simply 'release(db)'.
[3] the main code that creates the dialog should 'closeOutDB()' immediately after the 'block(db)' statement.


The dialog is actually 'released' after the code that calls release(db) ends. So you can release and then do a couple things, and when the callback ends THEN the code in the main funtion after the block executes.

Since you should routinely define your DB and DBE variables globally, your standard 'closeOutDB()' function would look like this:

 

void   CloseOutDB()
{   hide(db)
    destroy(db)
    db = null
}   // end CloseOutDB()


I don't believe there is any code that can ask if a Dialog is Modal or not. Don't know what happens when you 'release' a non-modal dialog.

 

 

 

  • Louie

 

 

Re: Difference between block() and show()
Mathias Mamsch - Tue Nov 23 14:39:46 EST 2010

Block will make the dialog box modal (meaning no other DOORS windows will react to input until the module is closed). After a block (i.e. when the dialog is hidden) execution will resume after the block. So block keeps executing the current DXL program, not temporarily exiting it and then resume it.

Note that while a DXL program is running, no DOORS windows will react to user input. If you do show, the DXL parser will end the DXL program(!) (which means the other DOORS windows will react again to your input) but keep its memory ressources active until the dialog is hidden, meaning the GUI will still be on the screen and react to user input (GUI callbacks being executed).

So show really is pretty much like a "halt".

Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Difference between block() and show()
thsturm - Wed Nov 24 05:09:23 EST 2010

Thank you for your detailed answer.
From where can I get this details?
Is there more than the DXL Reference Manual (and many, many try and error :( ?

Re: Difference between block() and show()
Mathias Mamsch - Wed Nov 24 09:11:36 EST 2010

llandale - Tue Nov 23 14:34:23 EST 2010

The 'block' displays a 'modal' box which MUST be disposed before you can do anything else in DOORS. Typical 'ack' boxes are 'modal', you must say [OK] to unlock the rest of the interface. The 'show' displays a normal dialog which does NOT prevent interaction with the rest of DOORS. When you 'show' a dialog, the user can still navigate in the module. There are some things that must be done after a dialog is 'realized' and before is it 'show'n or 'block'd.

Nothing executes after a 'show', all processing is done with callbacks, buttons, or applys. You should therefore take care to closeOutDB() (see below) inside your 'applyClose(DB)' function associated with the dialog.
Code indeed executes after the 'block' command once the dialog is 'released', again inside some callback, button, or apply. Don't have much experience with 'block' and hopefully someone with more experience will correct me, but I believe the following should be routine for modal dialogs:

[1] Your various callback/button/apply functions should simply 'release(db)' as the last thing they do, if they want to close the dialog.
[2] Any applyClose() you write should likewise simply 'release(db)'.
[3] the main code that creates the dialog should 'closeOutDB()' immediately after the 'block(db)' statement.


The dialog is actually 'released' after the code that calls release(db) ends. So you can release and then do a couple things, and when the callback ends THEN the code in the main funtion after the block executes.

Since you should routinely define your DB and DBE variables globally, your standard 'closeOutDB()' function would look like this:

 

void   CloseOutDB()
{   hide(db)
    destroy(db)
    db = null
}   // end CloseOutDB()


I don't believe there is any code that can ask if a Dialog is Modal or not. Don't know what happens when you 'release' a non-modal dialog.

 

 

 

  • Louie

 

 

@Louie:

I am not sure why this error is copy/pasted over and over again, but don't call destroy from a callback. It says so in the help and will lead to crashes under certain circumstances.

@thsturm: reading or asking in the forum, studying the perms list, the DXL Manual or trial & error (in this order) are the main information sources I guess :-)


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Difference between block() and show()
llandale - Mon Nov 29 10:16:18 EST 2010

Mathias Mamsch - Wed Nov 24 09:11:36 EST 2010
@Louie:

I am not sure why this error is copy/pasted over and over again, but don't call destroy from a callback. It says so in the help and will lead to crashes under certain circumstances.

@thsturm: reading or asking in the forum, studying the perms list, the DXL Manual or trial & error (in this order) are the main information sources I guess :-)


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Help says: <destroy(DB box)> "Note: Destroy should not be used within a callback function for a DBE." I presume that to refer to callbacks associated with non-button DBEs as with "set(DBE, callback(DBE))".

It must surely be ok to 'destroy' from the callback associated with the 'close' button, or in fact from any 'button' or 'apply'; just make sure you 'hide' it first and you should set the global DB to null aftewards. If its not OK to do so they you cannot 'destroy' a 'shown' dialog. I suspect the issue with the non-standard callbacks is that after you click the DBE and run the code, DOORS still process the 'click' that triggered the callback and tries to deal with the DBE, which no longer exists because it was just destroyed (analogy: "open the mail, burn the mail, read the mail" doesn't work). Not so with close/button/apply where nothing happens after that code runs.

In any case, I've never had a problem with it, at least for non-modal dialogs. As I said the modal ones should simply 'release(DB)' and let the main code hide and destroy it. But then, I wonder if a modal callback should 'release'?...

  • Louie