WhoCanDo Posted September 5, 2019 Share Posted September 5, 2019 Hi, 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. Regards Quote Link to comment
Julian Carr Posted September 5, 2019 Share Posted September 5, 2019 You need to use SelectChoice(). The index is zero based so make sure you load the menu from zero. Quote Link to comment
WhoCanDo Posted September 5, 2019 Author Share Posted September 5, 2019 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; begin 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); end; procedure DialogHandler (var Item : longint; Data : longint); procedure InitiateDialog; begin AddChoice (StanDialog1, 5, ' ', 0); AddChoice (StanDialog1, 5, 'A', 1); AddChoice (StanDialog1, 5, 'B', 2); SelectChoice (StanDialog1, 5, 2, TF); end; procedure GetDialogEvents; begin end; begin Case Item of SetupDialogC: InitiateDialog; 1 : GetDialogEvents; 2 : ; { Cancel } end; { Case } end; begin CreatePopUpLayout; If (RunLayoutDialogN (StanDialog1, DialogHandler, True) = 1 { OK }) then begin end; end; run (test); Quote Link to comment
WhoCanDo Posted September 5, 2019 Author Share Posted September 5, 2019 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. Quote Link to comment
Recommended Posts
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.