Jump to content

Pre-Select a choice in CreatePullDownMenu


WhoCanDo

Recommended Posts

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

Link to comment

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);

 

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