Jump to content

MDX Toolbar Tutorial


TG007

Recommended Posts

MDX Toolbar Tutorial

By Tek

 

Introduction

 

Before we begin, make sure that you have have the following:

› mdx.dll - Click Here

› bars.mdx - Click Here

› ktools.dll - Click Here

 

In this tutorial we will cover:

› Toolbars

› More soon!

 

Toolbars

 

;Example dialog code

dialog example {
title "Example"
size -1 -1 1000 18
option dbu
list 1, 1 2 1000 14, size
}

on *:dialog:example:init:0:{
;You must ALWAYS do this if you are going to use mdx on a control or dialog
;This tells mdx your mIRC version and the dialog you will be adding controls to
dll mdx.dll SetMircVersion $version
dll mdx.dll MarkDialog $dname
;This sets the desired listbox control to a toolbar control, we will look at the different styles later
dll mdx.dll SetControlMDX $dname 1 ToolBar list arrows flat wrap nodivider > bars.mdx
;Takes away the dialog's titlebar and border and takes off the control's border
dll mdx.dll SetDialog $dname style
dll mdx.dll SetBorderStyle 1
;Sets icon size
did -i $dname 1 1 bmpsize 16 16
;Adds icon IDs to the control
did -i $dname 1 1 setimage icon small icon1.ico
did -i $dname 1 1 setimage icon small icon2.ico
;Adds items into the control
;The bolded +a is called a FLAG - we will go through them later
;The bolded 1 is the icon ID that we set previously, using 1 will return icon1.ico, using 2 would return icon2.ico
;The bolded Hello is item's text, this can have a value or be left blank
;The bolded Tooltip! is the items tooltip, this text will appear when you hover over the item
did -a $dname 1 +a 1 Hello $chr(9) Tooltip!
did -a $dname 1 +a 2 Goodbye $chr(9) Tooltip!
;use this if you want to dock the dialog over mIRC's default
dll ktools.dll DockToolbar $dialog($dname).hwnd
}

;this is the event that will determine which button you clicked and what it will do
on *:dialog:example:sclick:1:{
;Sets %click to the ID that you clicked, the first toolbar item will return 2
var %click $did($dname,1).sel
;Checks if %click is the same as the selected item
if (%click == 2) {
;Command you want to use goes here!
}
elseif (%click == 3) {
;Command you want to use goes here!
}
}

 

Styles

 

There are five styles for a toolbar, they are:

› flat

› list

› wrap

› nodivider

› Arrows

 

› flat

 

Flat means that the toolbar has flat buttons, an example with the flat style used:

user posted image

If you didn't use flat, it would look like this:

user posted image

In my opinion flat style is better, but it is entirely up to you

 

› list

 

Using the list style it makes the text of an item aligned to the right instead of to the bottom, an example of list being used is:

user posted image

 

Yes, i know it is the same picture as before, but that's what the list style looks like lol

 

W ithout the list style, if you're docking the dialog into the mIRC default you wont be able to see it propely

 

› wrap

 

The wrap style ensures that the toolbar wraps to the next line on seperator boundaries

 

› nodivider

 

Using the nodivider style ensures the two pixel divider at the toolbar will not be shown, this should always be used on docked toolbars so that you can see the actual toolbar

 

› arrows

 

If you use the +v flag on an item it will show an arrow next to the item, this arrow is triggered as a double click (dclick)

 

 

Common Flags

 

+v

This is the flag that sets a little arrow next to your items (if your toolbar has the arrow style) when you click the arrow, it will act like a double click so you need to put your events for clicking arrows on a dclick

 

+c

This makes the item act like a checkbox

 

+cg

This groups the buttons together like radio boxes

 

+d

Disables the toolbar item

 

+i

"Indeterminate" - this means that the button is grayed

 

+p

The item is pushed in, like it would if you clicked it with +c/+cg on

 

+x

The item is checked

 

+w

You have specified an item width (+w <width>)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...