mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2018
Posts: 83
E
Babel fish
OP Offline
Babel fish
E
Joined: Apr 2018
Posts: 83
Was playing around with a dialog to control the colours in the nick list pane of a channel window, and found something strange.

I was laying out the text in the dialog to show the user class, symbol and a dropdown list of colours, and found that the & ($chr(38) for AOPs) character would not display - I got a space instead. Tried it as a text character and also as $chr without any luck. Examining the control (#10) via //echo -st $did($dname, 10).txt did display that the '&' character was still there.
Example code:
Code:
text "&", 10, 48 36 8 10

By chance (read desperation) I decided to try the following.
Code:
text "&&", 10, 48 36 8 10

and it did display a single '&' character

Is this a bug(ette) or something I missed in the help files and wikichip ?

Dialog code for information:
Code:
; Nick Coulours (NC) Preferences dialogue
dialog NCPrefernces {
  title "Nick Colour Preferences"
  size -1 -1 124 168
  option dbu
  text "Class", 1, 12 6 90 10
  text "Symbol", 2, 42 6 18 10
  text "Colour"3, 76 6 20 10

  text "Owner Colour", 6, 4 20 40 10
  text "~", 7, 48 20 8 10 
  combo  8, 66 20 50 11, drop

  text "AOP Colour", 9, 4 36 40 10
  ; text $chr(38) $+ $chr(38), 10, 48 36 8 10 
  text "&&", 10, 48 36 8 10 
  combo  11, 66 36 50 11, drop

  text "OP Colour", 12, 4 52 40 10
  text "@", 13, 48 52 8 10 
  combo 14, 66 52 50 11, drop

  text "Half OP Colour", 15, 4 68 40 10
  text "%", 16, 48 68 8 10 
  combo 17, 66 68 50 11, drop

  text "Voice Colour", 18, 4 84 40 12
  text "+", 19, 48 84 4 10 
  combo 20, 66 84 50 11, drop

  text "User Colour", 21, 4 100 40 15
  combo 23, 66 100 50 11, drop

  button "Colour On", 30, 5 124 30 12
  button "Reset", 31, 47 124 30 12
  button "Colour Off", 32, 88 124 30 12
  button "Ok", 40, 5 148 30 12, ok
  button "Apply", 41, 47 148 30 12
  button "Cancel", 44, 88 148 30 12, cancel
}


Joined: Jul 2006
Posts: 4,150
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,150
Hello, this is not a bug but a feature.

the & character can be used to create shortcut.

if you use "t&est" as the text, you can hit alt + e to access that text control (not so useful for text control but it's useful for menu namely and tab maybe).
&& is then the correct and intended way to render a &.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Apr 2018
Posts: 83
E
Babel fish
OP Offline
Babel fish
E
Joined: Apr 2018
Posts: 83
Thanks, I understand it now,
but,
in my opinion, this is the one place that should not be parsed by mIRC for any expansion/replacement etc. since the dialog component type is TEXT and is (possibly) the only place in mIRC scripting where you enclose the text in (double) quotes, which normally (in any other coding language) indicates that is is a literal text string.

Joined: Jul 2006
Posts: 4,150
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,150
That's not really a good argument because in any programming language with quoted string, the \ is usually a meta character interpreted to escape a quote: "stri\"ng".

The & usage is actually shown in the help file with the example for creating menu, but it's not described at all.
Wikichip didn't have anything about it, I added mIRC's example here: https://en.wikichip.org/wiki/mirc/dialogs#Mnemonic


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard