Interface Writer | [release] 3.0 | 22/08/2010 |
Author: |
Message: |
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
RE: RE: Interface Writer | [release] 1.2
quote: Originally posted by whiz
Ok, let's see.
js code: var ControlsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Controls/Control";
var ElementsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Elements/Element";
/
ret.Interface[WindowId] = new Object();
ret.Interface[WindowId].Controls = new Object();
ret.Interface[WindowId].Elements = new Object();
1) Am I able to create my own, like this? For example, to get the window title:
js code: var CaptionsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Attributes/Caption";
var TitlesXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/TitleBar/Title/Text";
But... it can't be enumerated:
js code: var K = new Enumerator(xml.selectNodes(CaptionsXPath));
It's different, because the value isn't "<Item Parameter="Value">", but "<Item>Value</Item>". How can I get that?
js code: var K = new Enumerator(xml.selectNodes(ControlsXPath));
if(K.count() > 0) {
for(; !K.atEnd(); K.moveNext()) {
var ControlNode = K.item();
var ControlId = ControlNode.getAttribute("Id");
// Define an object for this control type (as in ButtonControl or StaticControl) that contains the actual control
// Only done when necessary
if(ControlId in ret.Interface[WindowId].Controls) {
//[alert the user that there's 2 or more controls with the same ID]
continue;
}
// You'll have to do your own stuff here
ret.Interface[WindowId].Controls[ControlId] = "null" //[JScript control definition stuff]
}
}
2a) If that gets a control ID, then I assume that getting the type uses the same method, replacing ".getAttribute("Id")" with ".getAttribute("xsi:type")", right?
2b) Would this work:
[code left out]
1) yes.
2) also yes, but instead of "ControlLeft" and "ControlId" variables, you may wanna use an object with these properties:
code: var Control = new Object();
Control.Id = xmlNode.getAttribute("Id"); // xmlNode in this case is K.item();
Control.Type = xmlNode.getAttribute("xsi:type");
Control.Position = {
"Left" : xmlPosNode.getAttribute("Left"),
"Top" : xmlPosNode.getAttribute("Top"),
"Width" : xmlPosNode.getAttribute("Width"),
"Height" : xmlPosNode.getAttribute("Height") // Note that there's no comma on this one
}// Object definition, version 2
About the enumeration thingy: there's probably only one node, so enumeration would be useless with "var CaptionsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Caption";" and such. You can retrieve the caption using the following code:
JScript code: var CaptionXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Caption"
var node = xml.selectSingleNode(CaptionXPath);
var sCaption = node.text;
quote: Originally posted by whiz
I apologise for so many questions, but this is a confusing topic for me...
Never mind, I started with the same amount of questions
Oh and sorry for the late answer. Had no PC for over a week
This post was edited on 06-28-2009 at 07:20 AM by SmokingCookie.
|
|
06-28-2009 07:13 AM |
|
|
whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
O.P. RE: Interface Writer | [release] 1.5
quote: Originally posted by CookieRevised
ok, but it is way better to edit your first post and instead replace the old script with the new(est) version.
After that you can remove all the other attachments in your other posts, they aren't needed and people will still be able to download the wrong version.
(remember, not everybody reads an entire thread to know which version is which; mostly, if they see an attachment in a post (after they came directly to that post because they were referred to it fro manother thread), they probably think it is the latest version)...
Ok, done it.
quote: Originally posted by SmokingCookie
1) yes.
2) also yes, but instead of "ControlLeft" and "ControlId" variables, you may wanna use an object with these properties:
code: var Control = new Object();
Control.Id = xmlNode.getAttribute("Id"); // xmlNode in this case is K.item();
Control.Type = xmlNode.getAttribute("xsi:type");
Control.Position = {
"Left" : xmlPosNode.getAttribute("Left"),
"Top" : xmlPosNode.getAttribute("Top"),
"Width" : xmlPosNode.getAttribute("Width"),
"Height" : xmlPosNode.getAttribute("Height") // Note that there's no comma on this one
}// Object definition, version 2
Hang on, if "xmlNode" is "K.item()", then what's "xmlPosNode"?
quote: Originally posted by SmokingCookie
About the enumeration thingy: there's probably only one node, so enumeration would be useless with "var CaptionsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Caption";" and such. You can retrieve the caption using the following code:
JScript code: var CaptionXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Caption"
var node = xml.selectSingleNode(CaptionXPath);
var sCaption = node.text;
1) You can use ".getAttribute()" to get a value from an "<element type="value"/>" tag, and ".selectSingleNode()" + "[node].text" to get a value from an "<element>value</element>" tag. Is this right?
2) Can I use ".selectSingleNode()" and "[node].text" to get any text in XML written as "<element>value</element>"?
|
|
06-28-2009 09:30 AM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
RE: Interface Writer | [release] 1.5
xmlPosNode is xml.selectSingleNode("//Interfaces/Window[@Id=\"" + WindowId + "\"]/Controls/Control[@Id=\"" + ControlId + "\"]/Position");
1) Yes
2) yes (isn't that the same question as 1? )
|
|
06-28-2009 03:24 PM |
|
|
whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
O.P. RE: Interface Writer | [release] 1.5
Right, I think I might actually understand it now... I will keep working at it!
EDIT: Um... I need more help.
code: Message in Script Debugger
XML document must have a top level element.
at 0 (0)
What does that mean? There's nothing wrong with the file...
This post was edited on 06-29-2009 at 07:13 PM by whiz.
|
|
06-29-2009 06:31 PM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
RE: Interface Writer | [release] 1.5
That's what the forums are for
|
|
06-29-2009 07:12 PM |
|
|
mynetx
Skinning Contest Winner
Microsoft insider
Posts: 1175 Reputation: 33
37 / /
Joined: Jul 2007
|
RE: Interface Writer | [release] 1.5
quote: Originally posted by whiz
What does that mean?
Usually that refers to a missing root node, like <html> in HTML.
|
|
06-30-2009 07:31 AM |
|
|
whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
O.P. RE: Interface Writer | [release] 2.0 | 07/11/2009
|
|
11-07-2009 01:49 PM |
|
|
mynetx
Skinning Contest Winner
Microsoft insider
Posts: 1175 Reputation: 33
37 / /
Joined: Jul 2007
|
RE: Interface Writer | [release] 2.0 | 07/11/2009
Whiz,
Great job you’ve done. I have downloaded Interface Writer 2.0 and here are my suggestions on what you can make better There is no particular order in my list.
- Use a system dialog for opening and saving files. This allows easy selection of files without having to know their names. You can find more information about Common Dialogs at MSDN.
jscript code:
- Remove the help tooltip from the ListView listing all Controls/elements. The tooltip is needed for hovering ellipsed items in the grid.
- Add support for Interface Tester to see the changes without having to create a test script.
- Add support for custom attributes.
- Add options dialog for various options, like "auto-save when I change a field" or "auto-create backup on opening a file" or "change indention style on generated XMLs".
- Add a list of recently used files.
- Add texts to the bottombar buttons. Always hovering them to guess their meaning is a bit strange.
So far for this list. Don’t forget—what you’ve already done is amazing, just keep up the good work.
Best,
mynetx
|
|
11-07-2009 02:04 PM |
|
|
whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
O.P. RE: Interface Writer | [release] 2.0 | 07/11/2009
quote: Originally posted by mynetx
- Use a system dialog for opening and saving files. This allows easy selection of files without having to know their names. You can find more information about Common Dialogs at MSDN.
jscript code: cd = new ActiveXObject("MSComDlg.CommonDialog"); // create the object
cd.Filter = "All Files(*.*)|*.*|JScript Files(*.js)|*.js"; // set file filter
cd.FilterIndex = 2;
cd.MaxFileSize = 128; // must set MaxFileSize. otherwise you will get an error
cd.ShowOpen(); // show it to user
file = cd.FileName; // retrieve file + path
if (!file) { // If the user does enter file exit
MsgPlus.DisplayToast("", "You must enter a file name");
}
else {
MsgPlus.DisplayToast("", "The user selected:\n" + file );
}
I've just tested that, but it doesn't seem to work on initialization:
code: From the Script Debugger
Script is starting
Error: unknown (code: -2147221230)
File: FnInitialization.js. Line: 1.
Script has failed to start
Something wrong with the ActiveX object?
quote: Originally posted by mynetx
- Remove the help tooltip from the ListView listing all Controls/elements. The tooltip is needed for hovering ellipsed items in the grid.
Removed. But what do you mean by "ellipsed items"? Do you mean a tooltip for each window/control/element with extra details?
quote: Originally posted by mynetx
- Add support for Interface Tester to see the changes without having to create a test script.
Had just been thinking about that, but at the moment, I've done it so that the interface is saved as a temporary file, and then opened using MsgPlus::CreateWnd.
quote: Originally posted by mynetx
- Add support for custom attributes.
I'll work on this, but it would take a while to specify what attributes go with what in a list, so I'll probably let the user pick what attributes they want to use with a text area or something.
quote: Originally posted by mynetx
- Add options dialog for various options, like "auto-save when I change a field" or "auto-create backup on opening a file" or "change indention style on generated XMLs".
- Add a list of recently used files.
They'll both need the registry functions, but I'll add them. Eventually.
quote: Originally posted by mynetx
- Add texts to the bottombar buttons. Always hovering them to guess their meaning is a bit strange.
Fair enough. Will do.
|
|
11-07-2009 02:32 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RE: Interface Writer | [release] 2.0 | 07/11/2009
quote: Originally posted by whiz
quote: Originally posted by mynetx
Use a system dialog for opening and saving files. This allows easy selection of files without having to know their names. You can find more information about Common Dialogs at MSDN.
jscript code: cd = new ActiveXObject("MSComDlg.CommonDialog"); // create the object
cd.Filter = "All Files(*.*)|*.*|JScript Files(*.js)|*.js"; // set file filter
cd.FilterIndex = 2;
cd.MaxFileSize = 128; // must set MaxFileSize. otherwise you will get an error
cd.ShowOpen(); // show it to user
file = cd.FileName; // retrieve file + path
if (!file) { // If the user does enter file exit
MsgPlus.DisplayToast("", "You must enter a file name");
}
else {
MsgPlus.DisplayToast("", "The user selected:\n" + file );
}
I've just tested that, but it doesn't seem to work on initialization:
code: From the Script Debugger
Script is starting
Error: unknown (code: -2147221230)
File: FnInitialization.js. Line: 1.
Script has failed to start
Something wrong with the ActiveX object?
Yes, you do not have the proper design license.
I strongly suggest not to use that ActiveX, but instead use the proper Windows API.
See: CookieRevised's reply to UserAccounts.CommonDialog alternative for Vista
and "cd = " should be "var cd ="
Also (@mynetx):
quote: cd.MaxFileSize = 128; // must set MaxFileSize. otherwise you will get an error
128 is waaaaaaaay to low. The MaxFileSize is the maximum path length, this should at least be 260, like it is defined in Windows (=MAXPATH). So, a value like 2048 should be given on current systems.
quote: Originally posted by whiz
quote: Originally posted by mynetx
- Remove the help tooltip from the ListView listing all Controls/elements. The tooltip is needed for hovering ellipsed items in the grid.
Removed. But what do you mean by "ellipsed items"? Do you mean a tooltip for each window/control/element with extra details?
Ellipsed items are items which are too long to be displayed on one line. As such, the are cropped and "..." (an ellipsis) is added to the end. With default Windows behaviour, when you hover over such items a tooltip will pop up showing the complete line.
However, that does not mean you should not display a tooltip when items do fit in the available space. Common practice is to always show a tooltip when hovering over items (too long or not), when at least one item is too long to be displayed.
This post was edited on 11-07-2009 at 05:47 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
11-07-2009 05:43 PM |
|
|
Pages: (14):
« First
«
1
2
3
4
[ 5 ]
6
7
8
9
»
Last »
|
|