Dropdown List input box

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Dropdown List input box

Post by Esabik » Thu Oct 12, 2017 3:32 pm

Hi

Was trying to have a user Input early in the script, but I want to specify only 3 options for them to select from. Looking at list Box does not seem to be what I need. Similar to excel List mostly.
Microsoft Excel - Book1.jpg
Was not clear on how to search this one in the forum..... Has anyone done something similar?

Trying to get away from this:

Input>type,Is this customer Commercial Military or Medical(enter Com Mil or Med?
Wait>3

So instead of them possibly entering erroneous data, would rather they select from 1 of 3 list options.

Thanks
Just when you thought it was safe to go in the water........:evil:

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Dropdown List input box

Post by Marcus Tettmar » Thu Oct 12, 2017 3:46 pm

Create a small custom dialog with a combo box on it. Try this example:

Code: Select all

Dialog>MySelectDlg
object MySelectDlg: TForm
  Left = 837
  Top = 548
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  BorderStyle = bsSingle
  Caption = 'CustomDialog'
  ClientHeight = 191
  ClientWidth = 479
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -28
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 240
  TextHeight = 32
  object Label1: TLabel
    Left = 24
    Top = 24
    Width = 230
    Height = 32
    Caption = 'Choose something:'
  end
  object cboChoice: tMSComboBox
    Left = 21
    Top = 60
    Width = 436
    Height = 40
    ItemIndex = 0
    TabOrder = 8
    Text = 'Com'
    Items.Strings = (
      'Com'
      'Med'
      'Mil')
    ListText = 'Com'#13#10'Med'#13#10'Mil'#13#10
  end
  object MSButton1: tMSButton
    Left = 304
    Top = 120
    Width = 150
    Height = 50
    Caption = 'OK'
    ModalResult = 2
    TabOrder = 9
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 144
    Top = 120
    Width = 150
    Height = 51
    Caption = 'Cancel'
    TabOrder = 10
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>MySelectDlg

Show>MySelectDlg,r
If>r=2
  //get the item chosen
  GetDialogProperty>MySelectDlg,cboChoice,Text,theItem
  MessageModal>You chose: %theItem%
Endif
Capture.PNG
Capture2.PNG
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Re: Dropdown List input box

Post by Esabik » Fri Oct 13, 2017 7:54 pm

Hi, could not get yours to open up and work see image, but it gave me the additional ideas I needed. Thank you for getting back so quickly!!! :D

Here's what I got finally. Great ideas and its working now.

Code: Select all


Dialog>CustType
object CustType: TForm
  Left = 364
  Top = 153
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Order Type'
  ClientHeight = 118
  ClientWidth = 202
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 24
    Top = 8
    Width = 149
    Height = 16
    Caption = 'Order Type Selection'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object cboChoice: tMSComboBox
    Left = 25
    Top = 24
    Width = 145
    Height = 21
    ItemHeight = 13
    TabOrder = 0
    Text = 'OrderType'
    Items.Strings = (
      'Com'
      'Med'
      'Mil')
    ListText = 'Com'#13#10'Med'#13#10'Mil'#13#10
  end
  object MSButton1: tMSButton
    Left = 24
    Top = 48
    Width = 65
    Height = 33
    Caption = 'OK'
    ModalResult = 2
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 96
    Top = 48
    Width = 65
    Height = 33
    Caption = 'Cancel'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentFont = False
    TabOrder = 2
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>CustType
Show>CustType,r
    If>r=2
      //get the item chosen
      GetDialogProperty>CustType,cboChoice,Text,ListText
      MessageModal>You chose: %ListText%
    Endif

wait>500

Marcus_Macro.jpg
Just when you thought it was safe to go in the water........:evil:

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts