Author Topic: Dialog Combo box, using the _selected() sub  (Read 2761 times)

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Dialog Combo box, using the _selected() sub
« on: February 09, 2007, 12:18:54 AM »
Theres a small problem with it it looks like. I made a new dialog box, added a combo box to it, and added a single item to that. I also set up the selected sub. The problem is, the sub runs twice.

Click on the white space to open the combo box executes the sub once.
Click on the arrow and the sub will execute once.
Click on any of the items in the drop down box and the sub runs twice.

This applies to all the dialog boxes I have worked with, Only I didn't notice it until now.

Code: (Autoghost.ice) [Select]
' Autoghost script
Dim win_autoghost_menu
sub autoghost_menu()
win_autoghost_menu=CreateDialog("Autoghost",100,100,200,75)
AddComboBox win_autoghost_menu,5,5,185,20,1,0,"combo_Network"
AddComboBox win_autoghost_menu,5,30,185,20,2,0,"combo_Nicknames"
AddComboBox win_autoghost_menu,5,55,185,20,3,0,"combo_Actions"
ShowDialog win_autoghost_menu
AddItem 1,5,"Networks"
SetListItem 1,0,5
AddItem 2,5,"Protected Nicks"
SetListItem 2,0,5
AddItem 3,5,"Actions"
SetListItem 3,0,5
For a=lbound(split(getinifile("autoghost.ini","controls","Networks",""),",")) to ubound(split(getinifile("autoghost.ini","controls","Networks",""),","))
  AddItem 1,5,split(getinifile("autoghost.ini","controls","Networks",""),",")(a)
Next
End Sub

Sub combo_Network_Selected()
if GetListItem(1,5,1)<>0 then
  Net=GetListItem(1,5)
  ClearItems 2, 5
  AddItem 2,5,"Protected Nicks"
  SetListItem 2,0,5
  netnicks=split(getinifile("autoghost.ini","networks",net,""),",")
  for a=lbound(netnicks) to ubound(netnicks)
    AddItem 2,5,netnicks(a)
  next
end if
End Sub

Sub combo_Actions_selected()
SendCommand "/say TEST"
End Sub

I was clicking on the 'Actions' combo box to test this.
This message brought to you by the Wonderful Wizard of Oz.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1972
    • IceChat IRC Client
Re: Dialog Combo box, using the _selected() sub
« Reply #1 on: February 09, 2007, 12:46:11 AM »
Ok, simple problem, fixed it for my next build.
Thanks
The IceChat God