dcxdll
dcxdll copied to clipboard
Button - incorrect visual display, and new ideas for solution and improvement
I use a compiled build "DCX v3.1-1221-g09ed2f10" in mIRC v7.79 on Windows 11 23H2 x64
I'm trying to create my own beautiful "Switchbar", and for this I use buttons with a combination of different styles and colors. But I encountered several problems due to the imperfections and shortcomings of the control:
- When adding borders with the command
xdid -x dcx 4 +b, when trying to change the background color of a button, only the frame around the button changes color. This can be seen in the example of "Button 2". - To color the button in the desired color, you need to apply the style
bitmap, although this is not said anywhere in the documentation. But in this case, the set border for the button loses its color and becomes dark gray and the button loses its clicked effect. This can be seen in the example of "Button 3". - When adding an icon to a button, it is placed only before the name and in no other way. Besides, the name with the icon can be located only in the center of the button. I tried changing the position by adding
$str($chr(8199),10)(numeric space) to the end of the text, but this is more of a crutch than how I would like it to actually work. And with all this, if the number of characters exceeds the size of the button, then at the end of the button a completely unnecessary ellipsis appears in the way. This can be seen in the example of "Button 6". - After setting the text colors using the command
xdid -c, when click on the button, there is a periodic unpleasant flickering, especially if quickly move between buttons and press. In this example it's most visible on the first two buttons, and less noticeable on the others, but the flickering is there, and sometimes it spreads to all buttons, no matter which one is hovered over or clicked.
Screenshot with an example of testing regular buttons (this is not Switchbar), since problems arose already at this stage:

To address these and many other shortcomings, I have some great ideas for improving the control "Button":
- Add a new style
frameto display a frame around the button, with customizable pixel thickness and colors (in gradient) for different "Disabled/Hovering/Normal/Selected" states. - Add a visual effect setting on mouse click to move the button position 1px to the right and 1px down (when lbdown), and return back to its original position (when lbup).
- Add "Top/Right/Bottom/Left" internal padding setting in pixels for Icon & Text. Something similar to CSS.
- Add the ability to use images in any extensions "ICO/JPG/PNG/BMP/GIF" with customizable sizes as icons.
- Add a new style
leftto position the text on the left side of the button. - Add a new style
rightto position the text on the right side of the button. - Add a new style
iconleftfor the icon position near the left border of the button. (Can be used together withleftorrightand is independent of the selected text position). - Add a new style
iconrightfor the icon position near the right border of the button. (Can be used together withleftorrightand is independent of the selected text position). - Add a new style
iconafterto position the icon just after the text. (Can be used together withleftorright). - Add new style
ellipsisto enable ellipsis at the end of the button if the text length exceeds the button size. (Should be disabled by default). - Add a new style function
transparentso that can set transparency only for the background (not affecting the frame, icon and text).
The simplest code for testing. To run, enter the command: /button_test:
alias button_test { $iif($dialog(button_test),dialog -x button_test,dialog -m button_test button_test) }
dialog -l button_test {
title "Button test"
icon $mircexe,0
option pixels
size -1 -1 200 260
}
on *:DIALOG:button_test:init:*:{
dcx Mark $dname button_test_work
xdialog -b $dname +ty | xdialog -g $dname +b $rgb(15,15,22)
button_making $dname
}
alias -l button_making {
var %y 30, %i 1 | while (%i <= 6) {
if (%i == 1) {
xdialog -c $1 %i button 40 %y 120 30 notheme
xdid -x $1 %i +b
xdid -f $1 %i +b default 10 default
xdid -t $1 %i Button %i
}
if (%i == 2) {
xdialog -c $1 %i button 40 %y 120 30 noformat
xdid -x $1 %i +b
xdid -f $1 %i +b default 10 default
xdid -t $1 %i Button %i
xdid -C $1 %i +b $rgb(255,0,0)
}
if (%i == 3) {
xdialog -c $1 %i button 40 %y 120 30 noformat bitmap
xdid -x $1 %i +b
xdid -C $1 %i +b $rgb(71,110,25)
xdid -c $1 %i +dn $rgb(10,10,10)
xdid -c $1 %i +h $rgb(244,202,22)
xdid -c $1 %i +s $rgb(255,165,23)
xdid -m $1 %i 1
xdid -f $1 %i +b default 10 default
xdid -t $1 %i Button %i
}
if (%i isnum 4-6) {
xdialog -c $1 %i button 40 %y 120 30 notheme noformat bitmap vgradient
xdid -C $1 %i +b $rgb(71,110,25)
xdid -C $1 %i +g $rgb(71,110,25)
xdid -C $1 %i +G $rgb(41,65,16)
xdid -c $1 %i +dn $rgb(216,216,230)
xdid -c $1 %i +h $rgb(244,202,22)
xdid -c $1 %i +s $rgb(255,165,23)
xdid -m $1 %i 1
xdid -f $1 %i +b default 10 default
xdid -t $1 %i Button %i
}
if (%i isnum 5-6) {
xdid -l $1 %i 16
xdid -w $1 %i +n 18 $mircexe
}
if (%i == 6) {
xdid -w $1 %i +s 20 $mircexe
xdid -t $1 %i Button %i $str($chr(8199),10)
}
xdid -J $1 %i +r hand | xdid -R $1 %i +r 3
inc %i | inc %y 35
}
}
alias button_test_work {}