Ver 12 List Box Question

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Ver 12 List Box Question

Post by kpassaur » Sat Jun 12, 2010 10:08 am

In using ver 12 I have a Dialog with a list box. Nothing special it works fine etc. It has two options, Standard and Confidential when the user changes from one to another I want to automatically change a second list box.

So if Standard is selected the options are A,B,C,D if Confidential is selected the options are A,B,C (no D option)

With all the options in Ver 12 for a list box is there one that can be used to check for a change? to trigger an event etc. (update the second list) or do I have to add a continous loop somewhere that keeps checking for the value and the set the list in the second box.

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

Post by Marcus Tettmar » Sat Jun 12, 2010 4:52 pm

Use OnClick. Example:

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Left = 390
  Top = 181
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 223
  ClientWidth = 439
  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 MSListBox1: tMSListBox
    Left = 15
    Top = 21
    Width = 121
    Height = 97
    ItemHeight = 13
    Items.Strings = (
      'One'
      'Two'
      'Three')
    TabOrder = 8
    Text = 'Fruit'#13#10'Planets'#13#10'Cars'#13#10
    SelectedIndex = -1
  end
  object MSListBox2: tMSListBox
    Left = 215
    Top = 20
    Width = 121
    Height = 97
    ItemHeight = 13
    TabOrder = 9
    SelectedIndex = -1
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,MSListBox1,OnClick,OnList1Click
Show>Dialog1,r

SRT>OnList1Click
  GetDialogProperty>Dialog1,MSListBox1,SelectedIndex,itemSelected
  If>itemSelected=0
    Let>newList=Apples%CRLF%Pears%CRLF%Oranges
  Endif
  If>itemSelected=1
    Let>newList=Saturn%CRLF%Mars%CRLF%Venus
  Endif
  If>itemSelected=2
    Let>newList=Ford%CRLF%Toyota%CRLF%BMW
  Endif
  SetDialogProperty>Dialog1,MSListBox2,Text,newList
END>OnList1Click
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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