twig / dcxdll

Dialog Control eXtensions for mIRC
BSD 3-Clause "New" or "Revised" License
23 stars 2 forks source link

XDock - add support for dialog docking to create EditBar #41

Open EpicNet opened 3 years ago

EpicNet commented 3 years ago

I am using "mIRC v7.66" + "DCX dll v3.1-git394" in system "Windows 8.1 x64".

Once upon a time I had an interesting idea to create a toolbar with the title "EditBar" with buttons (and not only) directly above the "EditBox" field, so that by this would be convenient to use. More details about the concept of my idea are described here: Forum. This has long been implemented in various messengers, but unfortunately not supported in the mIRC client.

While scripting, I ran difficulties in creating such a project. At the moment, can only use this the "/xdock -c" command to pin the dialog in the right place. But this is not the option that will help to achieve the task. First, this dialog closes the first line of user messages and part of the scrollbar. Secondly, when the window or list are resized, the dialog does not remain in the desired position.

I would like to receive a new similar command to solve this problem. For example: "/xdock -e". Syntax: "/xdock -e [HWND_DOCK] [+FLAGS] [DESTINATION]". Flags: +hn - this two flags probably will be enough, but can think of additional ones. Destination: channel, query, status, custom.

This should help docked the dialog simultaneously below the chat window and above the "EditBox" field, but without going beyond the boundaries and without getting into the window with the list of nicknames. This panel should be able to automatically resize in horizontally or remain at a fixed size (docking to the left or right), and should be permanently glued to the top border of the "EditBox". It would be even better if there was an additional flag (switch) +c that decided how exactly to dock the dialog box. Only within the width of the channel window, or stretch along the entire length of the "EditBox" field to the edge of the mIRC main window, also raising the list of nicknames up. If the window does not have a list, then accordingly automatically along the entire length.

The second option is if the "EditBar" will be implemented as a new control, with all the additional functions and commands for changing the color, size, fixing the position and setting any child controls on it. Accordingly, it must have a command to enable and disable, to be displayed at the specified sizes and position, and to turn off with complete hiding.


📷 Screenshot1 , 📷 Screenshot2 , 🎥 Video

Here is a test piece of script to reproduce this the problem. To run the script click on "F5" or enter the command "/xdock_test":

alias F5 { xdock_test }
alias xdock_test {
  if ($dialog(xdock_test)) .dialog -x xdock_test
  else { .dialog -mp xdock_test xdock_test }
  .editbox -af
}
dialog xdock_test {
  size -1 -1 -10 -10
}
on *:DIALOG:xdock_test:init:*:{
  .dcx Mark $dname xdock_test_work
  .xdialog -b $dname +b
  .xdialog -g $dname +b $rgb(20,20,27)
  .timerXDOCK 1 0 xdock_channel $dname $active
}
alias xdock_channel {
  if ($dialog($1)) {
    .xdock -c $dialog($1).hwnd +h $channel($2).hwnd
    .xdialog -S $1 0 $calc($window($2).dh -25) -1 25
  }
}
alias xdock_test_work {}
OokEek commented 1 year ago

Here is some example code that does most of what you want, except the the dialog will still float over the text area.

alias xdock_test {
  if ($window(@xdock_test)) window -c @xdock_test
  ; create channel like window for testing
  window -ael20 @xdock_test
  ; save hwnd for later
  set %xdock_hwnd $window(@xdock_test).hwnd
  ; enable xdock signals
  dcx xSignal 1 +d
  if ($dialog(xdock_test)) dialog -x xdock_test
  dialog -mp xdock_test xdock_test
  editbox -af
}
menu @xdock_test {
  close: {
    ; cleanup
    if ($dialog(xdock_test)) xdialog -x xdock_test
    dcx xSignal 0 +d
    unset %xdock_hwnd
  }
}
dialog xdock_test {
  size -1 -1 -10 -10
}
on *:DIALOG:xdock_test:init:*:{
  dcx Mark $dname xdock_test_work
  xdialog -b $dname +b
  xdialog -g $dname +b $rgb(20,20,27)
  xdialog -c $dname 1 button 0 0 100 20
  xdialog -c $dname 2 button 0 0 100 20
  xdialog -c $dname 3 button 0 0 100 20
  xdid -t $dname 1-3 Button

  xdialog -l $dname root $chr(9) +ph 0 0 0 0
  xdialog -l $dname space root $chr(9) + 1 1 1 1
  xdialog -l $dname cell root $chr(9) +li 1 1 0 0
  xdialog -l $dname cell root $chr(9) +li 2 1 0 0
  xdialog -l $dname cell root $chr(9) +li 3 1 0 0

  .timerXDOCK 1 0 xdock_channel $dname @xdock_test
}
alias xdock_channel {
  if ($dialog($1)) {
    xdock -c $dialog($1).hwnd +hB $window($2).hwnd
    xdialog -S $1 0 $calc($window($2).dh -25) -1 25
    xdialog -l $1 update
  }
}
alias xdock_test_work { }
; $1 = dname, $2 = window name
alias -l xsize {
  xdialog -S $1 0 $calc($window($2).dh -25) -1 -1
}
on *:signal:DCX: {
  if ($1 != size) return
  if ($3 == %xdock_hwnd) {
    ; re-position on the fly
    xsize xdock_test @xdock_test
    ; fix final size
    .timerXSize 1 0 xsize xdock_test @xdock_test
  }
}
EpicNet commented 1 year ago

@OokEek Thank you. In principle, this is not a bad option and is better than nothing))) But there is another variant how to do this. Can create a panel, attach it, covering the entire space of the original channel window (or partially), then attach a custom @ window without an editbox to this panel so that there is space under it where you can also attach buttons, and attach your editbox even lower, and Attach a list of nicknames to the side if the original one was also hidden under the panel. All this in a single script bundle will create what I asked for, but this will only be a workaround.

If this impossible be done via "/xdock" as described in the request, except through a workaround, then in principle you can close this topic.