GUI: custom toolbar

By AnthraX01 on Oct 09, 2004

Since there has been a flux of shitty no-one can use snippets. I decided to bring code from my script and explain how you make those custom toolbars. You've seen in Chaos, MerkFX, Brutality, ect.

rip it if you please seems people liked my last snippet ;)

requirments:

basic scripting know-how
mirc v6.16 (duh?)
mdx.dll
bars.mdx
popup.dll
rebar.dll

;brutality toolbar by Mosh

;first of we have our dialog this is all you need for your nifty new toolbar!

dialog tb {
  title "tb"
  size -1 -1 514 1
  option dbu
  list 1, -1 -1 1001 16, size
}

;set this where your mxd.dll is
alias -l mdx return system\dlls\mdx.dll

;set this where bars.mdx is
alias -l mdx return system\dlls\bars.mdx

;heres where we get the icons from
alias -l icons return $+(system\icons\,$1-)

;this is for popup.dll is just edit the filenames
alias -l popup dll system\dlls\popups.dll $1-
alias -l popmenu { 
  tokenize 32 $dll(system\dlls\popups.dll,Popup,$1-) 
  if ($isid) { return $1- }
  if ($4- != did not select a menu item) { $4- }
}

;this is for rebar.dll
alias -l rebar.dll return system\dlls\ReBar.dll

;heres where we make the toolbar!
on *:dialog:tb:init:0:{
  ;basic needs for MDX to work
  dll $mdx SetMircVersion $version 
  dll $mdx MarkDialog $dname
  ;making the toolbar!
  dll $mdx SetControlMDX $dname 1 ToolBar list arrows flat wrap nodivider > $bars
  dll $mdx SetDialog $dname style
  dll $mdx SetBorderStyle 1
  ;here is where we start to make the icons
  ;size of icons id dbu I beleive
  did -i $dname 1 1 bmpsize 16 16
  ;these are the icons I use 
  did -i $dname 1 1 setimage icon large $icons(32-tux2.ico)
  did -i $dname 1 1 setimage icon large $icons(32-mirc.ico)
  did -i $dname 1 1 setimage icon large $icons(32-channels.ico)
  did -i $dname 1 1 setimage icon large $icons(32-help5.ico)
  did -i $dname 1 1 setimage icon large $icons(32-options.ico)
  did -i $dname 1 1 setimage icon large $icons(32-amp.ico)
  did -i $dname 1 1 setimage icon large $icons(32-away.ico)
  did -i $dname 1 1 setimage icon large $icons(32-autoj.ico)
  ;heres where we make text and tool tips! 
  ;please note: $chr(9) is what sets the text and the tool tips apart
  ;also notice the +v it makes the a drop down arrow you'll learn more about that later
  ;the numbers? they are the number of the icon the numbers are the same as you list the icons above ;)
  did -a $dname 1 +v 1 server $chr(9) connect to server
  did -a $dname 1 +a 1 -
  did -a $dname 1 +a 2 $chr(9) Mirc Options
  did -a $dname 1 +a 3 $chr(9) Channels list
  did -a $dname 1 +a 4 $chr(9) Mirc Helpfile
  did -a $dname 1 +a 1 -
  did -a $dname 1 +a 5 $chr(9) Options
  did -a $dname 1 +a 6 $chr(9) Mp3 Player
  did -a $dname 1 +a 7 $chr(9) Away System
  did -a $dname 1 +a 8 $chr(9) Auto Join
  ;how we dock this tool bar
  dll $rebar Dock $dialog($dname).hwnd > top
}
;remember that arrow?
;well that arrow when clicked gives a dclick event ;)
on *:dialog:tb:dclick:1: { popup }

;this is a popup!
;this is easy 
;eg text $cr command
alias popup { 
  popup New tb 16 16
  popup SetMetrics tb iconpad 0 0 contentpad 0 0 spacing 0 0
  popup AddItem tb end + 1 1 new connection $cr server -m
  popup AddItem tb end + 
  popup AddItem tb end + 2 2 razorville $cr server irc.razorville.co.uk
  popup AddItem tb end + 3 3 undernet $cr server  irc.undernet.org
  popup AddItem tb end + 4 4 elite-scriptaz $cr server irc.elite-scriptaz.net
  popup AddItem tb end + 5 5 rizon $cr server irc.rizon.net
  popup AddItem tb end + 6 6 creative $cr server irc.creativeirc.net  
  popup AddItem tb end +
  popup AddItem tb end + 7 7 disconnect $cr quit $read(docs\quits.txt)
  popmenu tb $mouse.dx $mouse.dy
}
;easy for scripters
;commands for the click on the icons
;note this isn't done ;x
on *:dialog:tb:sclick:1:{
  if ($did($dname,1).sel == 2) {
    if ($server) { .quit $read(docs\quits.txt) }
    if (!$server) { .server }
  }
  elseif ($did($dname,1).sel == 4) { alt o }
  elseif ($did($dname,1).sel == 5) { alt L }
  elseif ($did($dname,1).sel == 6) { help }
  elseif ($did($dname,1).sel == 8) {
    if (!$dialog(about)) { .dialog -md about about }
  }
  elseif (%click == 9) {
    if (!$dialog(amp)) { .dialog -md amp amp }
  }
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.