RadioGroup Sample Code

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

RadioGroup Sample Code

Post by armsys » Sun Jan 23, 2011 10:28 pm

The following script demonstrates the RadioGroup object:

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Left = 973
  Top = 167
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Test List'
  ClientHeight = 116
  ClientWidth = 211
  Color = clBtnFace
  Font.Charset = ANSI_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object RadioStockList: tMSRadioGroup
    Left = 8
    Top = 5
    Width = 105
    Height = 60
    Caption = 'Choose One'
    Items.Strings = (
      'Item 1'
      'Item 2'
      'Item 3')
    TabOrder = 1
    Text = 'Item 1'#13#10'Item 2'#13#10'Item 3'#13#10
  end
  object btnOK: tMSButton
    Left = 16
    Top = 74
    Width = 33
    Height = 25
    Caption = 'OK'
    DoubleBuffered = True
    ModalResult = 22
    ParentDoubleBuffered = False
    ParentShowHint = False
    ShowHint = False
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object btnCancel: tMSButton
    Left = 52
    Top = 74
    Width = 45
    Height = 25
    Caption = 'Cancel'
    DoubleBuffered = True
    ModalResult = 999
    ParentDoubleBuffered = False
    TabOrder = 2
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,RadioStockList,onClick,GetRadio
show>Dialog1,ModalResult
If>ModalResult=999
  Exit
Endif
MessageModal>Result
SRT>GetRadio
  GetDialogProperty>Dialog1,RadioStockList,ItemIndex,Result
END>GetRadio
Hope you find it interesting.
Last edited by armsys on Mon Jan 24, 2011 8:21 am, edited 2 times in total.

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

Post by Marcus Tettmar » Mon Jan 24, 2011 7:59 am

Is there a part of your code missing? All you have posted is a dialog definition.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Jan 24, 2011 8:23 am

Marcus,
Thanks for your reminder. I append the rest back to my original post.

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

Post by Marcus Tettmar » Mon Jan 24, 2011 8:53 am

There is no need for an OnClick handler here. All you need is:

Code: Select all

Show>Dialog1,ModalResult
If>ModalResult<>999
  GetDialogProperty>Dialog1,RadioStockList,ItemIndex,Result
  MessageModal>Result
EndIf
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Jan 24, 2011 9:43 am

Marcus,
Thanks for helping me improve my script.

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