Combobox/editbox variables - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Combobox/editbox variables (/showthread.php?tid=88228)
Combobox/editbox variables by ArkaneArkade on 01-09-2009 at 09:19 PM
Hey guys,
- Edit - complete change. My original problem was solved - I was treating the ChatWnd.Contacts as a string, not iterator. Solved it now.
I do have another thing, which I definitly need help with. I'm hoping for perhaps a pointer to a script doing similar, or even to be old it cant be done.
Basically, I want to make a window which will have 2 controls on it - a combobox, and a editbox. The combobox will be automatically populated with the email addresses of everyone in contact list, and I can do that part, but I want the editbox to be changeable, so that it will hold a custom string for each contact which will be shown, and can be changed as the combobox is changed. and then can be written to an xml file when save is clicked (again, I can handle the xml, it's purely the changing variables I need help with)
RE: Combobox/editbox variables by MeEtc on 01-10-2009 at 02:15 AM
Sure, that's definitly possible about changing the values. I'll write out some code after I get home in a bit.
I don't have any experience with using XML to store the data, but that shouldn't be too hard to do. I would recommend reading the data from the XML when the window opens and store it in an array relating to the email address of the contact. Store all the changes in memory until the window is destroyed to save disk operations.
Hopefully you have enumerated the ComboBox with an ItemData, otherwise you will have no way to link each value
JScript code: /*some global vars */
var currentContact = 0;
var aContacts = Array[];
var aContactData = Array[];
function On[i]WindowId[/i]Event_ComboSelChanged (Wnd, ControlId) {
newContact = Wnd.Combo_GetItemData(ControlId, Wnd.Combo_GetCurSel(ControlId));
aContactData[curentContact] = Wnd.GetControlText([i]EditBoxControl[/i])
Wnd.SetControlText([i]EditBoxControl[/i], aContactData[newContact]);
currentContact = newContact;
}
when the window with the controls are created, the 2 arrays aContacts and aContactData should be populated with this: the key value of the arrays should just be integers, the exact valuses aren't really important. The values to fill in on aContacts should be the email addresses, and aContactData the values of the EditBox. once the window is destroyed (OK button or whatever) write out the values the user recorded back to the XML file using a for loop
JScript code: for (var i =1; i<aContacts.Size; i++)
// use aContacts[i] and aContactData[i] to write out the array data
// make sure to remove the data from the array when the window is destroyed from any method: OK, Cancel, X in corner or otherwise
WDZ, fix GeSHi to allow BBCode
RE: Combobox/editbox variables by ArkaneArkade on 01-10-2009 at 07:46 AM
Thank you MeEtc. I was a bit confused by your stuff, but you did manage to prompt me into an idea of my own... which I realised was exactly what you're talking about when I finished it. All done and working now cheers man
|