I know what you mean with mdx help. I never got their readme till i started playing with it a lot. Let me see if I can explain it.
If you open their help file then click the bars help file toward the bottom, you will now see the various bars. Now, if you click on track bar, you now have the help for it. Here is the way it works.
The top item where it says
Host control: is the mirc item that it changes. So in your dialog, you are going to need a list in this case. Now, the requirements are: Should be
size, but should not be
hsbar,
vsbar, or
extsel That means just as it says. Now, lets create a demo dialog:
dialog trackbar {
title "New Project"
size -1 -1 150 25
option dbu
list 1, 0 0 150 15, size
button "Close", 2, 115 15 35 10, okay
}
Okay, now we have a simple dialog that is easy to demonstrate on. Now, Before we can play with it, in this case we need two files specificly. And with these two files, two aliases. I like to create a dll folder in my mirc directory to place these in. Just makes it easier and not a long path to type. So say we have $mircdir\dll for the dll's Now, we need the aliases:
/mdx { return $dll(dll\mdx.dll,$1,$2-) }
/bars { return dll/bars.mdx }
Now, that will point to both the mdx dll,a nd the required file that mdx needs for bar controls. Now, lets start to play with the trackbar. We have the track with
id 1 so remember that. Now, when you set a control, your always going to start with these two line:
/mdx SetMircVersion $version
/mdx MarkDialog $dname
That tells mdx we are running mirc <$version> and that we want to edit dialog <$dname>. Now, for editing id 1. Lets put this all into a initializing event:
on 1:DIALOG:trackbar:INIT:*: {
; initialize mdx
/mdx SetMircVersion $version
/mdx MarkDialog $dname
}
Okay, now anytime you work with changing an id with mdx, you have to do:
/mdx SetControlMDX <dialog> <id> <control> [properties] > <extention>Lets try to break this down. SetControlMdx justs means we're playing with this id. The dialog is usually $dname (unless your outside of the on dialog event, the id is the one your changing, the control are the links you click next to the images in the help file. In this case "TrackBar" is the control. The properties are anything in the help file that come under the
MDX Control Style Listing. In this case things like verticle, select, tooltips, etc. Now, the <extention> depends on what control your editing. A good way to figure it out is on the help file, look at the title bar. In this case it says
MDX Bar Controls, v-- Help Well, the bar tells me to use the bar library. That means the
> <control> control turns into
> $bars (the alias was just to help with pointing to the dll).
Okay, so for this case, we can do something like...
on 1:DIALOG:trackbar:INIT:*: {
; initialize mdx
/mdx SetMircVersion $version
/mdx MarkDialog $dname
; set id properties
/mdx SetControlMDX $dname 1 TrackBar noticks noautopsel > $bars
}
Okay, now our listbox is identified as a trackbar Now we can play with the looks. Now, if this is for an mp3 player, that means you want it to move with the duration of the song. This means we use
/did -i <dialog> <id> 1 [pos] [min] [max] So, if a song were playing we could use:
/did -i $dname 1 1 $insong.pos 1 $sound($insong.fname).length That will place it wherever the song is played, and set the length of the song. Now, lets put it all together:
; required aliases
alias mdx { return $dll(dll\mdx.dll,$1,$2-) }
alias bars { return dll/bars.mdx }
; alias to open the dialog
alias trackbar {
if ($dialog(trackbar)) /dialog -vie trackbar trackbar
else /dialog -md trackbar trackbar
}
;dialog code
dialog trackbar {
title "New Project"
size -1 -1 150 25
option dbu
list 1, 0 0 150 15, size
button "Close", 2, 115 15 35 10, okay
}
; event
on 1:DIALOG:trackbar:INIT:*: {
; initialize mdx
/mdx SetMircVersion $version
/mdx MarkDialog $dname
; set id properties
/mdx SetControlMDX $dname 1 TrackBar noticks noautopsel > $bars
; update the trackbar
/trackbar.update
; schedule updates every second
.timertrackbar 0 1 /trackbar.update
}
; update the trackbar with song
alias trackbar.update {
if ($dialog(trackbar)) {
if ($insong) /did -i trackbar 1 1 params $insong.pos 1 $sound($insong.fname).length
else /did -i trackbar 1 1 params 1 1 100
}
; dialog is closed
else .timertrackbar off
}
Now, just open it while a song is playing, and watch it move >:D