The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 intercept a dialog
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Malab

Germany
19 Posts

Posted - 08/07/2002 :  03:24:02 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I have designed a dialog with the dialog builder.
I starts it in Origin and it works proberly. With Labtalk I can react on events like [onInit] or [onOk]! But if I click OK the dialog unloads whatever in the script is written. Can I intercept the dialog with a message "Are you sure? Yes/No"! Is it possible to hinder the dialog on closing?

Mike Buess

USA
3037 Posts

Posted - 08/07/2002 :  07:43:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The default OK button will always close the dialog after the [OnOk] scripts run, so you'll have to create your own OK button to do what you want.

Dialog Builder steps...
1> Delete the existing OK button and its string table entry (if it has one).
2> Create a new button and double-click on it to bring up its properties.
3> Change its caption to OK.
4> Make a note of its ID (e.g., IDC_BUTTON1) and close properties.
5> Open the string table and create a new entry.
6> Give it the ID of your new button (IDC_BUTTON1).
7> Enter a caption, e.g., DialogName.OK
8> Rebuild, etc.

LabTalk steps...
9> The name of the section for your button is determined by the caption you entered in step 7. As I wrote it, the section should be called [OK.OnClick].
10> There are at least three LabTalk methods for creating your prompt, but 'type -c' is probably the simplest. It generates a prompt with OK and Cancel buttons and the Cancel button terminates script execution.

[OK.OnClick]
-- previous OnOk scripts --
type -c "Are you sure?"; // actually, insert this line where appropriate in your previous OnOK scripts
dialog.close(DllName,DialogName);

...Having said that, if you just want the ability to run the [OnOK] scripts without closing the dialog it would be better to create an Apply button. To do that, leave the default OK button alone and do the following.

Dialog Builder...
1> Create a new button and set the ID to ID_APPLY_NOW and the caption to Apply.
2> Create a string table entry with the same ID and the caption DialogName.Apply

LabTalk...
3> The [OnApply] section should already exist, but create it if not.

[OnApply]
run.section(,OnOK);

I hope that helps.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/07/2002 07:47:11 AM

Edited by - Mike Buess on 08/07/2002 08:09:18 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000