Jump to content

Mdx Button


Silo

Recommended Posts

Hmmm, check this out. I decided to make an MDX button on my custom nicklist (Yup, X-Fusion - I have one, too!) using the MDX toolbar feature, that has my nick on it. Soooo, the idea is that as well as my nick, the icon wil also change with various levels - Op, Hop, Voice etc. Pretty basic stuff. This is what I found interesting on my test button (i'm using two icons for the experiment one red the other green). The idea is that on each event change, the button will still display my nickname, and reflect the appropriate icon suit what status I'm on.

 

When clicking the update button, it performs as it should, however, it then actualy creates a new button on every click there after. I bet I'm doing something really, really stupid. Maybe with how I'm calling on the icon to change.

 

Any ideas? :)

 

alias m {
  dialog -m ico.test ico.test
}

dialog ico.test {
  title "New Project"
  size -1 -1 72 128
  option dbu
  list 1, 2 3 66 10, size
  button "Update", 2, 30 112 37 12
}

on *:dialog:ico.test:init:*:{
  createmdx
  dll $mdx SetControlMDX $dname 1 ToolBar list wrap nodivider > $bar
  dll $mdx SetBorderStyle $dname 1 noborder
  did -i $dname 1 1 bmpsize 18 18
  did -i $dname 1 1 setimage icon medium $icon(famfam/user_red.ico)
  did -i $dname 1 1 setimage icon medium $icon(famfam/user_green.ico)
  did -a $dname 1 1 $me
}
alias update {
  did -o ico.test 1 2 1
  did -a $dname 1 1 $me
}
On *:Dialog:ico.test:sclick:2:{
  update
}

Link to comment
Share on other sites

Guest Travis

For starters, $dname only works in a dialog event. Not in a lone alias like your update alias.

 

 

Use an $iif statement or an alias to either set the icon as 1 or 2.

 

You probably want to clear the button then redo it.

 

did -ra icon.text 2 1 $me

 

Im guessing with that. It;s been a while, may have to do a seperate command to clear the button. You may not even need to clear the button.

 

did -a icon.text $iif(%update,2,1) 1 $me

 

 

Something like this, where if %update is $true use icon 2, else use icon 1.

 

 

Link to comment
Share on other sites

For starters, $dname only works in a dialog event. Not in a lone alias like your update alias.

 

When correcting people you should make sure that you're correct first.

 

Identifiers like $nick, $chan, $dname, $did, etc, are passed on to any custom aliases that are called from within an event definition where that identifier was filled.

 

You can check this by using the following code:

 

dialog t {
  size -1 -1 300 300
}
on *:dialog:t:init:*: update
alias update echo -a $dname

 

Then just type "/dialog -m t t" without the quotes and you should see the letter "t" (the dialog name) echoed in the active window.

Link to comment
Share on other sites

Hi Hixxy, glad to see you're still alive and well :) Thank you for clarifying the whole $dname within a custom alias for me. I often use it without any problems at all, though when somebody like Travis, with far more experience than myself (and whose work I admire), gives that sort of advice I tend to take it on board.

 

Hope all is well in the world of Hixxy :)

Link to comment
Share on other sites

Guest Travis

Oh thanks, I always get that wrong.

 

 

Regardless I never use $dname anymore. I always write the static name of the dialog. I figure it is a lot less to evaluate.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...