Jump to content

Pre-Select a choice in CreatePullDownMenu

Recommended Posts



I have a CreatePullDownMenu in my Dialog Box and I have loaded it with AddChoice


How do I choose to select ItemIndex 10 on the PullDownMenu ?


I have been trying SelectChoice without luck.


SetFocusOnItem works to focus on the ComponentID but I also want to separately set ItemIndex 10 to be the focus.



Share this post

Link to post

Thanks Julian, I've tried SelectChoice among several others but it's still not working. Maybe I'm putting it in the wrong place, even though I've been moving it around during my attempts.


procedure test;
var StanDialog1 : longint; TF : boolean;

procedure CreatePopUpLayout;
  StanDialog1 := CreateLayout ('Component Data', False, 'OK', 'Cancel');
  CreateStaticText (StanDialog1, 4, 'Item:', 15);
  CreatePullDownMenu (StanDialog1, 5, 10);
  SetFirstLayoutItem (StanDialog1, 4); SetRightItem (StanDialog1, 4, 5, 0, 0);

procedure DialogHandler (var Item : longint; Data : longint);

    procedure InitiateDialog;
      AddChoice (StanDialog1, 5, ' ', 0);
      AddChoice (StanDialog1, 5, 'A', 1);
      AddChoice (StanDialog1, 5, 'B', 2);
      SelectChoice (StanDialog1, 5, 2, TF);
    procedure GetDialogEvents;
Case Item of SetupDialogC: InitiateDialog;
  1 : GetDialogEvents;
  2 : ; { Cancel }
  end; { Case }

If (RunLayoutDialogN (StanDialog1, DialogHandler, True) = 1 { OK }) then begin end;
run (test);


Share this post

Link to post

Thanks for putting me on the right track Julian,


My fault. I should have put SelectChoice (StanDialog1, 5, 2, True); instead of SelectChoice (StanDialog1, 5, 2, TF);


From the other procedures I tried, TF was a boolean result, not an boolean option.

Share this post

Link to post

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.

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.


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...