Jump to content

Mdx To Dcx


WRCLiam

Recommended Posts

Hi guys, I'm having problems trying to convert a toolbar i made with MDX

 

Where would i put the sclick for DCX button

 

bit of code

 

  xdialog -c $dname 1 toolbar -3 -3 496 34 flat top list tooltips arrows tabstop
  xdid -l $dname 1 32
  xdid -m $dname 1 0
  xdid -a $dname 1 1 +cv 100 1 $rgb(255,0,0) Button $chr(9) Tooltip
  xdid -w $dname 1 +n 0 C:\Users\Liam\Kaleidoscope\sys\k.ico
  cb_alias $dname sclick 1 1 echo -a test
}

 

I did read the manual put that doesnt give much help

Link to comment
Share on other sites

Hey there,

 

Just to extend on what Travis was saying, I thought I'd provide you with a sampler, just to help you out so you can know what to do :) Cause DCX is a tad tricky especially when your new to it!

 

;// So you have your Dialog Table...

dialog mf_tb_table {
  title ""
  size -1 -1 625 37
}

on *:DIALOG:mf_tb:init:0:{

;// YOU NEED THIS!! It allows the Call back alias to work!
  dcx Mark $dname cb_function

    xdialog -c $dname 1 toolbar -3 -3 496 34 flat top list tooltips arrows tabstop
  xdid -l $dname 1 32
  xdid -m $dname 1 0
  xdid -w $dname 1 +n 0 C:\Users\Liam\Kaleidoscope\sys\k.ico
  xdid -a $dname 1 1 +cv 100 1 $rgb(255,0,0) Button $chr(9) Tooltip

;//Docks toolbar
  .timertb_dock 1 0 xdock -m $dialog($dname).hwnd +t

}
alias cb_function {
  if ($2 != mouse) echo -s $1-
}

 

Okay, so thats the full example code, and just to explain bits of it..

 

In your INIT Dialog Event, you need to have a line such as:

dcx Mark $dname <callback alias>

 

This allows the dialog to know that, when theres activity with the mouse, or keyboard involving the dialog... It will resort to reading this alias... (In basic terms)

 

alias cb_function {
  if ($2 != mouse) echo -s $1-
}

 

Is your call back alias.. (You can change the name whatever suits :) )

So what this above alias does is, when your dialog is open, test your dialog by clicking on buttons or typing in edit boxes, and in your status window, you will receive a DEBUG type of code, something like...

 

$dname sclick 1 1

 

So.. basically these are general ideas...

$1 == Dialogs Name ($dname)

$2 == Event (sclick, dclick, mouseenter mouseleave) etc....

$3 == Controls ID Number

In this case for the toolbar.. you may have a $4 and thats the BUttons ID on the toolbar...

So how do we put all this so something happens when I click a button....

 

We go back to your callback alias.. and enter the neccessary code!

alias cb_function {
  if ($2 != mouse) echo -s $1-
if ($2 == sclick) {
if ($3 == 1) && ($4 == 1) echo -s Hello I clicked the button!!! 
}
}

 

The above example is for a toolbar button, while the below example is for like a button and a toolbar!

alias cb_function {
  if ($2 != mouse) echo -s $1-
if ($2 == sclick) {
if ($3-4 == 1 1) echo -s You click the Toolbar Button!

elseif ($3 == 4) You clicked a button!
}
}

 

Anyway, I've started to babble a bit, so I'm sure you can see and get the idea behind it!

 

Hope this helps!

 

Kind Regards,

Daniel

Edited by Dan*
Link to comment
Share on other sites

Ok, so...

 

on *:dialog:k_bart:*:*: {
  if ($devent == init) {
    dcx Mark $dname k_bart_cb
    xdialog -b $dname +mntyz

   ;// Call initilisation alias
    k_bart_init_dcx
  }
}

----------to this---------
on *:dialog:k_bart:*:*: {
  if ($devent == init) {
    dcx Mark $dname k_bart_cb
    xdialog -b $dname +mntyz

   ;// Call initilisation alias
    k_bart_init_dcx
    cb_alias $dname sclick 1 1 echo -a test
  }
}

 

?

Link to comment
Share on other sites

Um.. Good try, but unfortunately its not correct...

 

From using your code... you need... to have a your DIALOG EVENT commands.. then a seperate Alias which will be your callback...

on *:dialog:k_bart:*:*: {
  if ($devent == init) {
    dcx Mark $dname k_bart_cb
    xdialog -b $dname +mntyz
  }
}

alias k_bart_cb {
if ($2 == sclick) {
if ($3-4 == 1 1) echo -s Testing this!
}
}

 

Notice the k_bart_cb in your Dialog INIT where it has... "dcx Mark $dname k_bart_cb"

This means that it has already set your CallBack Alias... All you need to do is create the alias...

 

That is where the alias "k_bart_cb" comes in...

Using the the Guide of...

$1 == Dialogs Name ($dname)

$2 == Event (sclick, dclick, mouseenter mouseleave) etc....

$3 == Controls ID Number

In this case for the toolbar.. you may have a $4 and thats the Buttons ID on the toolbar...

 

You create an "If Statement" saying.. if ($2 == sclick)

AND

if ($3-4 == 1 1)

THEN

echo -s testing!

 

 

Just like the alias shows!

Does this make sense??

 

Hope this helps,

 

Kind Regards,

Daniel

Edited by Dan*
Link to comment
Share on other sites

Sorry Dan, you must have posted at the same time as me. Thanks for your help mate. Just one more question, when the toolbar is docked it still have the titlebar, and its very small, how would i get rid of the titlebar and make the toolbar ... dialog size, make any sence?

 

cheers

 

EDIT: Fixed!

Edited by WRCLiam
Link to comment
Share on other sites

Hey

 

(Still trying to convert)

 

I finaly have the slick working great, now for this

 

the xdid below doesnt seem to be working, i've also tryed -t and -o the button is for connect and dissconnect

alias update_k {
  if (!$dialog(k_bart_table)) { halt }
  else {
    scid $activecid
    if ( $scid($activecid).status = connecting || $scid($activecid).status = connected ) { 
      xdid -a $dname 1 1 +cvb 0 1 $rgb(255,0,0) Dis $chr(9) Tooltip
    }
    else {
      xdid -a $dname 1 1 +cvb 0 1 $rgb(255,0,0) Con $chr(9) Tooltip
    }
  }
}

;// Callback alias for k_bart
alias k_bart_cb {
  if ($2 != mouse) {
    echo $color(info) -s */ k_bart_cb: $1-
    if ($3-4 == 1 1) if ($scid($activecid).status = connecting || $scid($activecid).status = connected ) { scid $activecid disconnect }
    else {
      scid $activecid server
    }
    update_k
  }
}

Edited by WRCLiam
Link to comment
Share on other sites

I've come up with this, but still no work, status window gos crazy and mirc crashes

 

alias k_bart_cb {
  if ($2 != mouse) {
    echo $color(info) -s */ k_bart_cb: $1-
    if ($3-4 == 1 1) if ( $scid($activecid).status = connecting || $scid($activecid).status = connected ) { 
      set %pres disc
      xdid -v k_bart 1 1 Disconnect
    }
    else {
      set %pres conn
      xdid -v k_bart 1 1 Connect
    }
  }
}

================EDIT=================

 

I've worked it out!

Edited by WRCLiam
Link to comment
Share on other sites

When I'm working on a dcx dialog I add this little snippet to the call back alias. Put it at the beginning. You can change $1- to test for things.

 

if (!$window(@cb)) window -e @cb

echo @cb . $1-

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...