Newbie Questions regarding Dialogs

Started by KeithW, November 27, 2024, 02:09:03 PM

Previous topic - Next topic

KeithW

Greetings,

I am try to implement a utility program entirely in WB.  I have the most current version at this time (2024-B) and would need about 9 Dialogs to complete the program.  Questions:

1 Is it allowable to have multiple Dialogs in the same program?

2 What are the issues to deal with IF you can have multiple Dialogs in the same program?

I wanted to store info in a Sqlite database.

Any suggestions or pointers would be great.

Regards,
Keith

JTaylor

Yes.  Some obvious things but just being thorough:

If you open a dialog from another dialog then you would not have access to the parent until the child is closed.  If you need multiple open at the same time then you will need to call a different script/exe rather than the dialog.

Make sure your dialog variable names and procedure names are unique.

I assume you know there is an official SQLite Extender now?

I think you might have WB_RAD already, if not, you might find that a huge help.  If not interested in a third-party option, there is some similar functionality in Studio but they don't carry things as far as WB_RAD does.  If you use WB_RAD, make sure you reset your win_track or dlg_var variable (depends on version) when you return from a child dialog

Jim

KeithW

Jim,

Thanx for the reply...

I can live with only one Dialog open at a time, I do believe.

Understand the Dialog name and variables being unique.
Question, if the variables are NOT unique will the values be shared across Dialogs?

Yes, I have the SQLite Extender

I do have WB_RAD. I looked at using it, but got a little overloaded trying to start using it.
Although I would like to give it a try.  I think I have v3.7, the most current ???

Keith


JTaylor

You may or may not know that the dialogs are loaded into memory as variables.  Do a variable dump using IntControl 77 is unsure of what I mean.   If you look at the dialog structure the first value before the = is the variable name.  If your Dialog name is the same it will overwrite at least some of the other dialogs variables.   If your main dialog is unique and you Call() the sub-dialogs it probably won't matter for sub-dialogs since it would load them fresh each time.  If you #include them then it would as they sit in memory.  I would consider this one of those cases where unique names is just good form and you won't have to worry about it even though you could work around the issue.

Yes on 3.7.   Did I send you a video focused just on the main parts related to the dialog stuff or was that someone else?
 

Jim

spl

Maybe off base, but depending if your utility is based on choices then a main 'menu' dialog would allow multiple sub-dialogs otherwise if the script will traverse options with pop-up dialogs for options those variables should not conflict if cleared before returning to main script.
Stan - formerly stanl [ex-Pundit]

cssyphus

The final line in a dialog, the one that actually opens the dialog, is the line:

YourVar = Dialog('MyDlg', 1)

An important note that may not have already been stated is that you can define multiple dialogs in your script, and set them all to Dialog('DlgName',0) - and they will not be opened but remain in memory.

When you need to open a specific dialog, you just call:

RetrnVar = Dialog('SumDlgName', 1)

Attached is a simple demo with one main menu and two submenus that allow you to switch between them.

snowsnowsnow

Just an FYI - Whenever I did stuff with dialogs in WB (which isn't that much - I never did that much with them), I always put each dialog into a separate UDF - that takes care of the "keep the variables separate/distinct" issues.

KeithW

Quote from: cssyphus on November 28, 2024, 01:36:23 PMThe final line in a dialog, the one that actually opens the dialog, is the line:

YourVar = Dialog('MyDlg', 1)

An important note that may not have already been stated is that you can define multiple dialogs in your script, and set them all to Dialog('DlgName',0) - and they will not be opened but remain in memory.

When you need to open a specific dialog, you just call:

RetrnVar = Dialog('SumDlgName', 1)

Attached is a simple demo with one main menu and two submenus that allow you to switch between them.

I appreciate the example and wanted to check it out, but alas it does not work on my system.
I get what I presume is the main menu, with no buttons and I have to kill the process as there is no other way to exit that I can see.  If I understood more I would try to fix, but I am not there as of yet.

Keith