[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  windowmenu sub-menus

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: windowmenu sub-menus
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Sat 23 Oct 2010 08:08 PM (UTC)  quote  ]
Message
Nick Gammon said:
It doesn't occupy a list position - I have clarified the documentation to make that clear.

Ahh, okay. Got it.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 23 Oct 2010 08:07 PM (UTC)  quote  ]

Amended on Sat 23 Oct 2010 08:08 PM (UTC) by Nick Gammon

Message
Well, ticking isn't implemented, that was an example.

However to answer your question, if the first character is "!" then it is removed, and then the rest of the list treated in the usual way. However the fact that it was there is remembered for the way the results are returned.

Using the "!" in this way however falls within the scope of "reserved characters".

However the current behaviour is sort-of what you suggest anyway, the "!" is removed, so if you wanted to start a submenu, or use a "!" you could then do so.

It doesn't occupy a list position - I have clarified the documentation to make that clear.

[EDIT]

And if you didn't want numeric results, but wanted to use the "!" then you would use: (space) !

The documentation for WindowMenu says "Leading and trailing spaces are removed from each item." - and thus the extra space would not have any effect (apart from defeating the test of "!" in the first position).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Sat 23 Oct 2010 07:41 PM (UTC)  quote  ]
Message
Hmm... So what if we want to tick the first item and use the index-based return value? That would take up two positions. Maybe it should be something more like this?

"! | *first item"

If the first item starts with !, just enable the flag and drop that item from the list

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 23 Oct 2010 07:20 PM (UTC)  quote  ]

Amended on Sat 23 Oct 2010 07:21 PM (UTC) by Nick Gammon

Message
Fiendish said:

So what happens now if you want your menu option to start with "!"?


See:

http://www.gammon.com.au/scripts/doc.php?function=WindowMenu

WindowMenu docs said:

WARNING - we reserve non alpha-numeric characters in the first position of each item for future expansion. For example, perhaps in future versions "*Equip" might be used to tick the Equip item.


I have reserved those characters for future use in cases such as this.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Sat 23 Oct 2010 05:54 PM (UTC)  quote  ]
Message
Well, I am just me, but I cannot really think of any good reason to start a menu item with a !. Can you?
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sat 23 Oct 2010 02:12 PM (UTC)  quote  ]
Message
Nick Gammon said:

These are not necessarily Lua functions (they use COM to be compatible with all scripting languages).

However if you were prepared for only Lua to have this second value, yes that could be done.

Oh I see. Yeah, that wouldn't be fair to other languages.
So what happens now if you want your menu option to start with "!"?

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Mr.lundmark   (35 posts)  [Biography] bio
Date Sat 23 Oct 2010 12:06 PM (UTC)  quote  ]
Message
Awesome! Thanks!
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 23 Oct 2010 07:48 AM (UTC)  quote  ]
Message
http://www.gammon.com.au/scripts/showrelnote.php?version=4.65&productid=0

Point 6.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Mr.lundmark   (35 posts)  [Biography] bio
Date Sat 23 Oct 2010 07:22 AM (UTC)  quote  ]
Message
Return a number? Is the number the index in the first list or the second list? Or will there be any way to get both indices?
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Tue 19 Oct 2010 08:19 PM (UTC)  quote  ]
Message
Modified in version 4.65 to return a number if the first character of the string is the "!" character. This is compatible with all scripting languages and is the simplest to implement.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sun 17 Oct 2010 10:11 PM (UTC)  quote  ]
Message
These are not necessarily Lua functions (they use COM to be compatible with all scripting languages).

However if you were prepared for only Lua to have this second value, yes that could be done.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sun 17 Oct 2010 09:14 PM (UTC)  quote  ]
Message
Nick Gammon said:

Since I want to have backwards compatibility, and don't want to add another argument, how about some special prefix, eg. "!" in front of the whole string? If present, you get an index back instead of a string (eg. 1, 2, 3).

Failing that, just another function like WindowMenuIndex or something.

Would a second return value as given by loadfile not satisfy the requirements?

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sun 17 Oct 2010 08:40 PM (UTC)  quote  ]
Message
Since I want to have backwards compatibility, and don't want to add another argument, how about some special prefix, eg. "!" in front of the whole string? If present, you get an index back instead of a string (eg. 1, 2, 3).

Failing that, just another function like WindowMenuIndex or something.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Sun 17 Oct 2010 08:18 PM (UTC)  quote  ]

Amended on Sun 17 Oct 2010 08:20 PM (UTC) by Twisol

Message
No arguments there. (Also, I meant WindowInfo, since we're taking about miniwindow menus.)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sun 17 Oct 2010 08:16 PM (UTC)  quote  ]
Message
Twisol said:

An alternative might be adding a new GetInfo selector that returns the index of the most recent menu selection. No backwards compatibility problems there.

That would be an extremely ugly use of GetInfo that violates all sorts of code design rules.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


6,495 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]