Single Line Editing.
[Edit] - Added double click editing.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 251
Top = 104
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Challenge 8'
ClientHeight = 235
ClientWidth = 529
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Position = poDesktopCenter
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 256
Top = 118
Width = 111
Height = 16
Caption = 'Selection Editor'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label2: TLabel
Left = 128
Top = 200
Width = 361
Height = 26
Caption =
'Both MSListBox and MSComboBox have their selection separated by ' +
'CRLF. '#13#10' Press enter in the Selections Editor to create more sel' +
'ections.'
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentColor = False
ParentFont = False
end
object Label3: TLabel
Left = 264
Top = 64
Width = 84
Height = 16
Caption = 'Line To Edit'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object MSComboBox1: tMSComboBox
Left = 24
Top = 16
Width = 392
Height = 21
ItemHeight = 13
TabOrder = 0
Items.Strings = (
'Item1'
'Item2'
'Item3')
ListText = 'Item1'#13#10'Item2'#13#10'Item3'#13#10
end
object MSListBox1: tMSListBox
Left = 24
Top = 56
Width = 170
Height = 137
ItemHeight = 13
Items.Strings = (
'Item1'
'Item2'
'Item3')
TabOrder = 1
Text = 'Item1'#13#10'Item2'#13#10'Item3'#13#10
SelectedIndex = -1
end
object MSButton1: tMSButton
Left = 228
Top = 168
Width = 75
Height = 25
Caption = 'Update Lists'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 2
DoBrowse = False
BrowseStyle = fbOpen
end
object MSButton2: tMSButton
Left = 336
Top = 168
Width = 75
Height = 25
Caption = 'Cancel'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 3
DoBrowse = False
BrowseStyle = fbOpen
end
object MSComboBox2: tMSComboBox
Left = 224
Top = 82
Width = 183
Height = 21
ItemHeight = 13
TabOrder = 4
end
object Edit1: TEdit
Left = 228
Top = 136
Width = 183
Height = 21
TabOrder = 13
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,MSButton1,OnClick,DoUpdateList
AddDialogHandler>Dialog1,MSButton2,OnClick,DoExit
AddDialogHandler>Dialog1,MSComboBox2,OnChange,DoListLine
AddDialogHandler>Dialog1,MSListBox1,OnDblClick,DoGetItem
GetDialogProperty>Dialog1,MSListBox1,Text,Items
Separate>Items,crlf,Items
// Create Line Numbers for ComboBox.
let>LineList={""}
let>asd=0
While>asd<Items_count>asd=%asd%+1
ConCat>LineList,asd
ConCat>LineList,crlf
EndWhile
SetDialogProperty>Dialog1,MsComboBox2,ListText,%LineList%
Show>Dialog1,r
srt>DoUpdateList
GetDialogProperty>Dialog1,Edit1,Text,Selection
let>Items_%Listed%=%Selection%
let>Items=%Items_1%;%Items_2%;%Items_3%
StringReplace>Items,;,crlf,Items
Separate>Items,crlf,Items
SetDialogProperty>Dialog1,MSComboBox1,ListText,%Items%
SetDialogProperty>Dialog1,MSListBox1,Text,%Items%
SetDialogProperty>Dialog1,Edit1,Text,
SetDialogProperty>Dialog1,MSComboBox2,ItemIndex,-1
END>DoUpdateList
srt>DoListLine
GetDialogProperty>Dialog1,MSComboBox2,Text,Listed
let>Temp=Items_%Listed%
SetDialogProperty>Dialog1,Edit1,Text,%Temp%
END>DoListLine
srt>DoGetItem
GetDialogProperty>Dialog1,MSListBox1,SelectedIndex,BeIndex
GetDialogProperty>Dialog1,MSListBox1,SelectedItems,BeText
SetDialogProperty>Dialog1,MSComboBox2,ItemIndex,BeIndex
SetDialogProperty>Dialog1,Edit1,Text,%BeText%
END>DoGetItem
srt>DoExit
exit
END>DoExit