function messageComboBox( name, items)
if type(items) ~= 'table' or items == nil then
return
end
local form = createForm(false)
form.Width = 400
form.Height = 55
form.BorderStyle = bsSingle
form.Position = poScreenCenter
form.PopupMode = 0
form.Caption = name or 'Select Item'
local combobox = createComboBox(form)
combobox.Width = form.Width - 20
combobox.AnchorSideLeft.Control = form
combobox.AnchorSideTop.Control = form
combobox.BorderSpacing.Left = 10
combobox.BorderSpacing.Top = 5
local button = createButton(form)
button.Width = 50
button.AnchorSideLeft.Control = form
button.AnchorSideTop.Control = form
button.BorderSpacing.Left = form.Width / 2.5 - 15
button.BorderSpacing.Top = 30
button.Caption = 'OK'
local button1 = createButton(form)
button1.Width = 50
button1.AnchorSideLeft.Control = form
button1.AnchorSideTop.Control = form
button1.BorderSpacing.Left = button.BorderSpacing.Left + 50
button1.BorderSpacing.Top = 30
button1.Caption = 'Cancel'
for i = items[0] == nil and 1 or 0,#items do
combobox.items.add(tostring(items[i]))
end
form.OnClose = function(sender)
if combobox.ItemIndex == -1 and not button1.Pressed then
messageDialog("Item can't be empty!\nPlease select item from box!",mtWarning,mbOK)
return
end
if button.Pressed or button1.Pressed then
return caFree
end
end
button.OnClick = function(sender)
button.Pressed = true
form.Close()
end
button1.OnClick = function(sender)
button1.Pressed = true
form.Close()
end
form.showModal()
return combobox.ItemIndex >= 0 and combobox.ItemIndex or nil
end
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum