Notifications
Clear all
[Closed] Adding DoubleClick Event to Flowlayoutpanel Buttons
Mar 07, 2020 11:57 pm
i’m Trying to Add DoubleClick Event to flowlayoutpanel Buttons but its not Working!, How Can i Fix That?
i Tried Both Ways (DoubleClick) and (MouseDoubleClick)
THANKS in ADVANCED
if test_roll != undefined then try(destroyDialog test_roll)catch()
rollout test_roll "TEST"
(
dotNetControl 'flp_test' "flowlayoutpanel" pos:[10,10] width:170 height:90
fn add_btns =
(
for i = 1 to 6 do (
btn = dotnetobject "Button"
btn.flatstyle = (dotNetclass "System.Windows.Forms.FlatStyle").flat
btn.backcolor = (dotnetclass "System.Drawing.Color").FromArgb 40 40 40
btn.forecolor = (dotnetclass "system.drawing.color").FromArgb 230 230 230
btn.FlatAppearance.BorderSize = 0
btn.text = i as string
btn.tag = dotNetObject "System.String" "Its Working !"
fn btn_DoubleClick = (print "Its Working !")
fn btn_MouseDoubleClick btn arg = (
if arg.button == arg.button.left do (print btn.tag)
)
dotNet.addEventHandler btn "MouseDoubleClick" btn_MouseDoubleClick
dotNet.addEventHandler btn "DoubleClick" btn_DoubleClick
dotNet.setLifeTimeControl btn #dotNet
test_roll.flp_test.Controls.Add(btn)
)
)
on test_roll open do (
flp_test.backcolor = (dotnetclass "System.Drawing.Color").FromArgb 55 55 55
flp_test.controls.clear()
add_btns()
)
)
createdialog test_roll 190 110
2 Replies
Mar 07, 2020 11:57 pm
you need rewrite a button , such as inherit a label as button
it’s an additional work , and wasteful if just for a DBClick event
Mar 07, 2020 11:57 pm
Thanks AEI for Replay ,
i got workaround
if test_roll != undefined then try(destroyDialog test_roll)catch()
rollout test_roll "TEST"
(
dotNetControl 'flp_test' "flowlayoutpanel" pos:[10,10] width:170 height:90
local prev_timestamp = timestamp()
fn btn_MouseDoubleClick arg ev =
(
local t = timeStamp()
if (t - prev_timestamp) < 200 do
(
prev_timestamp = t
format "Double clicked\n"
)
prev_timestamp = t
)
fn add_btns =
(
for i = 1 to 6 do
(
btn = dotnetobject "Button"
dotNet.addEventHandler btn "MouseUp" btn_MouseDoubleClick
dotNet.setLifeTimeControl btn #dotNet
test_roll.flp_test.Controls.Add btn
)
)
on test_roll open do
(
add_btns()
)
)
createdialog test_roll 190 110
THANKS to jahman for this Solution .