Jump to content
Developer Wiki and Function Reference Links ×

Dialog Confusion... hmm?


Recommended Posts

I want to enable certain items when a check box is checked.

I figured something like the following would suffice:

IF ItemSel(5) THEN SetItemEnable(8,TRUE);

or

IF ItemSel(5) THEN BEGIN

SetItemEnable(8,TRUE);

SetItemEnable(9,TRUE);

SetItemEnable(10,TRUE);

END;

I've also tried the following:

IF ItemSel(5) THEN check01:= 1 ELSE check01:= 0;

IF (check01=1) THEN SetItemEnable(8,TRUE);

I can't seem to get any of these to work.

Maybe I'm entering the code in the wrong place?

I am using modern dialogs.

Below is the Dialog I am trying to fit this code into:

PROCEDURE Drive_Dialog(VAR item:LONGINT; data:LONGINT);

VAR

cstr: STRING;

BEGIN

CASE item OF

SetupDialogC: BEGIN

{ Pulldown Menu 1 }

InsertChoice(18,4,'1/4"');

InsertChoice(18,0,'1/32"');

InsertChoice(18,1,'1/16"');

InsertChoice(18,2,'1/8"');

InsertChoice(18,3,'3/16"');

InsertChoice(18,5,'3/8"');

InsertChoice(18,6,'1/2"');

InsertChoice(18,7,'3/4"');

InsertChoice(18,8,'1"');

InsertChoice(18,9,'1/1/2"');

InsertChoice(18,10,'2"');

InsertChoice(18,11,'3"');

InsertChoice(18,12,'1"=10');

InsertChoice(18,13,'1"=20');

InsertChoice(18,14,'1"=30');

InsertChoice(18,15,'1"=40');

InsertChoice(18,16,'1"=50');

InsertChoice(18,17,'1"=100');

{ Pulldown Menu 2 }

InsertChoice(20,4,'1/4"');

InsertChoice(20,0,'1/32"');

InsertChoice(20,1,'1/16"');

InsertChoice(20,2,'1/8"');

InsertChoice(20,3,'3/16"');

InsertChoice(20,5,'3/8"');

InsertChoice(20,6,'1/2"');

InsertChoice(20,7,'3/4"');

InsertChoice(20,8,'1"');

InsertChoice(20,9,'1/1/2"');

InsertChoice(20,10,'2"');

InsertChoice(20,11,'3"');

InsertChoice(20,12,'1"=10');

InsertChoice(20,13,'1"=20');

InsertChoice(20,14,'1"=30');

InsertChoice(20,15,'1"=40');

InsertChoice(20,16,'1"=50');

InsertChoice(20,17,'1"=100');

{ Pulldown Menu 3 }

InsertChoice(22,4,'1/4"');

InsertChoice(22,0,'1/32"');

InsertChoice(22,1,'1/16"');

InsertChoice(22,2,'1/8"');

InsertChoice(22,3,'3/16"');

InsertChoice(22,5,'3/8"');

InsertChoice(22,6,'1/2"');

InsertChoice(22,7,'3/4"');

InsertChoice(22,8,'1"');

InsertChoice(22,9,'1/1/2"');

InsertChoice(22,10,'2"');

InsertChoice(22,11,'3"');

InsertChoice(22,12,'1"=10');

InsertChoice(22,13,'1"=20');

InsertChoice(22,14,'1"=30');

InsertChoice(22,15,'1"=40');

InsertChoice(22,16,'1"=50');

InsertChoice(22,17,'1"=100');

{ Pulldown Menu 4 }

InsertChoice(24,4,'1/4"');

InsertChoice(24,0,'1/32"');

InsertChoice(24,1,'1/16"');

InsertChoice(24,2,'1/8"');

InsertChoice(24,3,'3/16"');

InsertChoice(24,5,'3/8"');

InsertChoice(24,6,'1/2"');

InsertChoice(24,7,'3/4"');

InsertChoice(24,8,'1"');

InsertChoice(24,9,'1/1/2"');

InsertChoice(24,10,'2"');

InsertChoice(24,11,'3"');

InsertChoice(24,12,'1"=10');

InsertChoice(24,13,'1"=20');

InsertChoice(24,14,'1"=30');

InsertChoice(24,15,'1"=40');

InsertChoice(24,16,'1"=50');

InsertChoice(24,17,'1"=100');

END;

1:BEGIN

Elev01:=GetField(7);

Elev02:=GetField(10);

Elev03:=GetField(13);

Elev04:=GetField(16);

DNum01:=GetField(26);

DNum02:=GetField(28);

DNum03:=GetField(30);

DNum04:=GetField(32);

IF ItemSel(5) THEN Check01:= 1 ELSE Check01:= 0;

IF ItemSel(8) THEN Check02:= 1 ELSE Check02:= 0;

IF ItemSel(11) THEN Check03:= 1 ELSE Check03:= 0;

IF ItemSel(14) THEN Check04:= 1 ELSE Check04:= 0;

IF (check01=1) THEN SetItemEnable(8,TRUE);

GetSelChoice(18, 0, gScale01, cstr);

GetSelChoice(20, 0, gScale02, cstr);

GetSelChoice(22, 0, gScale03, cstr);

GetSelChoice(24, 0, gScale04, cstr);

END;

END;

END;

BEGIN

g_ID:= Define_Dialog;

IF VerifyLayout(g_ID) THEN BEGIN

g_Result:=RunLayoutDialog(g_ID,Drive_Dialog);

Link to comment

You are missing the code for each item in the case statement. Whenever you click on an item, the case statement gets executed and looks for that item number (i.e. 5,8,11 or 14) in the case statement. In your code, you are only handling calls to the setup and item 1, which is the OK button.

You need to structure the code something like this:

CASE item OF

SetupDialogC:

BEGIN

....

END;

1:

BEGIN

...

END;

5:

BEGIN

IF ItemSel(5) THEN Check01:= 1 ELSE Check01:= 0;

IF (check01=1) THEN SetItemEnable(8,TRUE);

END;

8:

BEGIN

IF ItemSel(8) THEN Check02:= 1 ELSE Check02:= 0;

END;

11:

BEGIN

IF ItemSel(11) THEN Check03:= 1 ELSE Check03:= 0;

END;

14:

BEGIN

IF ItemSel(14) THEN Check04:= 1 ELSE Check04:= 0;

END;

END;

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...