Jump to content

how do you add an item to a pull down menu?


Guest

Recommended Posts

I'm trying to create a pull down menu. I can create the menu and the pull down box but I can't seem to figure out how to add items into the list. Anyone know how to do this? The guide does a pretty poor job explaining.

Link to comment

In your event routine, do something like this:

IF item = SetupDialogC THEN

BEGIN

InsertChoice( kPullDown, 0, 'choice 0');

InsertChoice( kPullDown, 1, 'choice 1');

InsertChoice( kPullDown, 2, 'choice 2');

InsertChoice( kPullDown, 3, 'choice 3');

InsertChoice( kPullDown, 4, 'choice 4');

num := 1;

SelChoice( kPullDown, num, true);

END;

Link to comment

Now that I have my choices in the drop down menu how do I get the menu to stay up. For some reason as soon as I select an item from the drop down menu the whole dialog box exits like I hit the OK button.

Link to comment

{$STRICT 10}

{$NAMES 10}

procedure main;

var pulldown1, pulldown2 : longint;

dialog1, dialog2, dialog1_button, dialog2_button : longint;

procedure HandleEvents( var item: longint; data : longint );

var test : longint;

begin

IF item = SetupDialogC THEN

BEGIN

InsertChoice(pulldown1, 1,'Mesh');

InsertChoice(pulldown1, 2,'Solid Vynil');

SelChoice( pulldown1, 1, true);

END;

if (item = 1) then

begin

setbelowitem(dialog2,pulldown1,pulldown2,0,0);

InsertChoice(pulldown2, 1, 'Black Mesh -- 61"');

InsertChoice(pulldown2, 2, 'Black Mesh -- 73" w/ centerline');

InsertChoice(pulldown2, 3, 'Black Mesh -- 73" no centerline');

InsertChoice(pulldown2, 4, 'Blue Mesh -- 61"');

InsertChoice(pulldown2, 5, 'Blue Mesh -- 73"');

InsertChoice(pulldown2, 6, 'Green Mesh -- 49"');

InsertChoice(pulldown2, 7, 'Green Mesh -- 55"');

InsertChoice(pulldown2, 8, 'Green Mesh -- 61"');

InsertChoice(pulldown2, 9, 'Green Mesh -- 67"');

InsertChoice(pulldown2, 10, 'Green Mesh -- 73" w/ centerline');

InsertChoice(pulldown2, 11, 'Green Mesh -- 73" no centerline');

InsertChoice(pulldown2, 12, 'Trampoline(Black) -- 61"');

InsertChoice(pulldown2, 13, 'Trampoline(Black) -- 73" no centerline');

end;

if ( item = 2 ) then

begin

setbelowitem(dialog2,pulldown1,pulldown2,0,0);

InsertChoice(pulldown2, 14, 'Green 72"');

end;

end;

begin

dialog1 := createlayout('Save File?',FALSE,'Exit','Continue');

createstatictext(dialog1,1,'This operation can not be undone so it is recommended that',-1);

createstatictext(dialog1,2,'you EXIT and then save this file before you continue.',-1);

setfirstlayoutitem(dialog1,1);

setbelowitem(dialog1,1,2,0,0);

dialog1_button := runlayoutdialog(dialog1,nil);

dialog2 := createlayout('Choose a material type.',FALSE,'Exit','OK');

CreateStaticText(dialog2,1,'Choose a material type:',-1);

pulldown1 := 2;

pulldown2 := 3;

CreatePullDownMenu(dialog2,pulldown1,32);

CreatePullDownMenu(dialog2,pulldown2,32);

setfirstlayoutitem(dialog2,1);

setbelowitem(dialog2,1,pulldown1,0,0);

dialog2_button := runlayoutdialog(dialog2,HandleEvents);

if ( dialog2_button = 1 ) then

begin

end;

end;

run(main);

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...