What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » General Help with Interfaces

Pages: (2): « First [ 1 ] 2 » Last »
General Help with Interfaces
Author: Message:
Crazed
New Member
*

Avatar

Posts: 12
33 / Male / Flag
Joined: Nov 2007
O.P. General Help with Interfaces
Hey all,

I'm relatively new to Plus scripting and totally new to the Win32 API (but not JavaScript or programming in general) and I was wondering if anyone could offer me a little direction.

I'm not asking for a complete solution, but I'm having a few problems conceptualizing and designing a window (and more specifically, what goes into it). I've read the documentation for creating scripts, but I find its information on the interface files to be, while informative, not very friendly.

The situation is a script that needs to dynamically create N number of rows (set by another XML file, but that's irrelevant to this topic) of three columns, each containing a label and two text boxes, in the window. So, what I need is some type of control(s) that can be added on the fly.

I've tried using a ListView for this, but I find I can make only the first column editable, and even being able to edit that column is not consistent. So, my first question is "Can I use a ListView, and if so, what am I doing wrong?"

If a ListView is not what I need for this situation, then my second question is "what are the right controls for this situation?"

In any case, is there any more information on some of the controls found in the interface schema that is easy to digest for someone who hasn't worked with the API before? Because honestly, I've just been piecing things together on my own, which is totally fine for something which I understand (scripting for example), but is quite a bit harder for a technology to which I am a relative novice.

Please let me know if you can help me with this, or if I'm not making any sense. Thanks. :)

(Just to let you know in case you're interested, the script started as a simple dice roller and is turning into a complete DnD supplemental tool to help while playing sessions in MSN. It's turning out quite well, and this window is for generating characters)

This post was edited on 11-30-2007 at 06:34 AM by Crazed.
11-30-2007 06:27 AM
Profile PM Web Find Quote Report
Toneo
Junior Member
**

Avatar
Epic.

Posts: 35
Reputation: 2
28 / Male / Flag
Joined: Jul 2007
Wink  RE: General Help with Interfaces
Hmm.

First, to create your window:
var Wnd = MsgPlus.CreateWnd('XMLFile.xml','WindowIdentifier');
This creates your window, and it can be accessed through Wnd, as declared.

I also recommend you have your window initialization code in a seperate function for flexibility.

And to add items to a ListView, use this.

Wnd.LstView_AddItem("ListView","MainText",Data[Number],Position[Number]);
Note: Parameters Data and Position are optional!

Okay, so say you wanted to add three items, you could do this in two ways.

Way one:

var Wnd = MsgPlus.CreateWnd('XMLFile.xml','WindowIdentifier'); //Initialize Window!
Wnd.LstView_AddItem("ListView","Item 1",0); //Add Item 1
Wnd.LstView_AddItem("ListView","Item 2",1); //Add Item 2
Wnd.LstView_AddItem("ListView","Item 3",2); //Add Item 3

// And repeat for each item. 0, 1, 2 .etc are the data for each element

Way two:

var Wnd = MsgPlus.CreateWnd('XMLFile.xml','WindowIdentifier'); //Initialize Window!
var items = new Array('ItemOne','ItemTwo','ItemThree','ItemFour','ItemFive');

for (i=0; i<=items.length; i++)
{
Wnd.LstView_AddItem("ListView",items[i],2); //Add Item based on array
}

Hopefully that helped! If you have any other problems ask me.
Although I don't think I answered your question correctly, did I?

.plsc File Attachment: ListViewTest.plsc (1.39 KB)
This file has been downloaded 276 time(s).

This post was edited on 11-30-2007 at 07:32 PM by Toneo.
[Image: signature-user=291&back=4&clr=12,102,237&size=80.png]
11-30-2007 07:30 PM
Profile E-Mail PM Find Quote Report
Crazed
New Member
*

Avatar

Posts: 12
33 / Male / Flag
Joined: Nov 2007
O.P. RE: General Help with Interfaces
Thanks for the quick reply! Believe it or not, that's precisely what I'm doing right now to test this method. This is the code I'm using:
code:
function OpenNewProfileWindow() {
    var Wnd = MsgPlus.CreateWnd("InterfaceTest.xml", "ProfileChooser");
    Wnd.Combo_SetCurSel("ChooseProfile", Wnd.Combo_AddItem("ChooseProfile", "Dungeons and Dragons 3.5"));
    var item =Wnd.LstView_AddItem("ListViewer", "Test");
    Wnd.LstView_SetItemText("ListViewer", item, 0, "Test 1");
    Wnd.LstView_SetItemText("ListViewer", item, 1, "Test 2");
    Wnd.LstView_SetItemText("ListViewer", item, 2, "Test 3");
}

That quick and dirty code isn't made for release, but I'm just doing it to see how the controls work. That does work as intended, except for one thing: I can't get the fields to be editable. I've attached the interface I've made.

Here's a picture for reference of what it looks like right now.
[Image: plus-dialog1.jpg]

I can't edit or select any of the columns except for the first one, and even that doesn't always work. The user needs to be able to edit the last two columns.


If you could tell me how to do that, I would be very grateful. At least I'm thinking in the right direction so far, I think. :)

.zip File Attachment: InterfaceTest.zip (966 bytes)
This file has been downloaded 270 time(s).

This post was edited on 11-30-2007 at 07:53 PM by Crazed.
11-30-2007 07:50 PM
Profile PM Web Find Quote Report
Toneo
Junior Member
**

Avatar
Epic.

Posts: 35
Reputation: 2
28 / Male / Flag
Joined: Jul 2007
RE: General Help with Interfaces
Well, what you're making looks pretty cool.
Ah. And editing different columns is where i'm stuck too. I'm trying to find out how to edit a column other than the first, but so far i've had no luck. :( But i'm still trying to figure it out.

Oh, and if you need help saving these "Profiles" onto the computer, I can help you if you'd like. :)

Also: I think there's another way, using multiple listboxes that change together, but I would suggest leaving that until we're sure that columns other than the first can be accessed.

This post was edited on 11-30-2007 at 07:59 PM by Toneo.
[Image: signature-user=291&back=4&clr=12,102,237&size=80.png]
11-30-2007 07:54 PM
Profile E-Mail PM Find Quote Report
Crazed
New Member
*

Avatar

Posts: 12
33 / Male / Flag
Joined: Nov 2007
O.P. RE: General Help with Interfaces
Thanks, I hope it'll turn out alright when it's done - after I get this part down and do a few more things, it should be ready for a public release. Originally I made it for a few friends and I, but it should be a good general release.

Let me know if you find out anything new about the text. :) I had some problems with ListBoxes. I couldn't get one to display properly. What are they compared to ListViews?

As for saving the profiles, I *should* be alright. I'm pretty good with the DOM and hopefully creating an XML file from scratch should be no problem in JScript. Information like that I can piece together. I'll let you know if I have any problems, though, when we get to that point.

This post was edited on 11-30-2007 at 08:24 PM by Crazed.
11-30-2007 08:23 PM
Profile PM Web Find Quote Report
Toneo
Junior Member
**

Avatar
Epic.

Posts: 35
Reputation: 2
28 / Male / Flag
Joined: Jul 2007
RE: General Help with Interfaces
Okay. Note, it's not JavaScript, it's JScript 5.6 (or something like 5.6).

If you want to edit the FileSystem you'll need to use ActiveXObject();.

ListBoxes, compared to ListViews, are just single boxes that can list stuff just rows rather than boxes that have rows and columns.

I was going to attach a ListBox version but the script suddenly decided to play up and throw up the evil "null is null or not an object" error... which I get A LOT. :@
[Image: signature-user=291&back=4&clr=12,102,237&size=80.png]
11-30-2007 08:41 PM
Profile E-Mail PM Find Quote Report
Crazed
New Member
*

Avatar

Posts: 12
33 / Male / Flag
Joined: Nov 2007
O.P. RE: General Help with Interfaces
Have you had any luck? I did some searching, and it appears from other sites (ones about VB, mostly) that only the first column is editable. If I do do different boxes for them instead of a ListView, how will I dynamically create as many as I need?

Thanks. :)
12-01-2007 01:58 AM
Profile PM Web Find Quote Report
Toneo
Junior Member
**

Avatar
Epic.

Posts: 35
Reputation: 2
28 / Male / Flag
Joined: Jul 2007
RE: General Help with Interfaces
I've also searched, and no, I don't think you can edit any but the first column. What a silly thing to do. I hope they add a feature to change any column.

ListBoxes do seem like a good idea, unfortunately you can't dynamically change the amount of listboxes unless you find a way to edit the XML file dynamically and then redraw the window.

Actually, I think that's possible. Here's a [Link] to the FileSystem tutorial i've made. Even if you think you know how you should use it to refresh your memory. =)

As for redrawing the window (to show the new ListBoxes) I think that if you search you'll find that Interop.Call() can help you. But I can't remember the complete command from the top of my head.

I hope what you're making goes well, though! :D
[Image: signature-user=291&back=4&clr=12,102,237&size=80.png]
12-01-2007 07:46 AM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: General Help with Interfaces
I'm afraid there really is no way to get multiple editable columns in one row in a ListViewControl.

I also tried to move the editable field to another column, and I somewhat succeeded in that. :P I was using the Win32 API to re-order the columns after creation using LVM_SETCOLUMNORDERARRAY. The only problem was that it also moved any checkboxes or images placed in front of a row to another column, which I didn't like. Therefore, I dropped that. However, if you don't need anything in front of your rows, this may just work for you. :) PM me if you need help with this.

However, I really think Patchou should look into this. It'd be much easier if we could use editable ListViews, and it would also make our windows much nicer. :P
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-01-2007 09:09 AM
Profile E-Mail PM Web Find Quote Report
Toneo
Junior Member
**

Avatar
Epic.

Posts: 35
Reputation: 2
28 / Male / Flag
Joined: Jul 2007
RE: General Help with Interfaces
Yeah. It's kinda annoying. Oh well, I suppose Patchou'll add editable ListViews to the next update of Plus.
[Image: signature-user=291&back=4&clr=12,102,237&size=80.png]
12-01-2007 09:40 AM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On