Notifications
Clear all
[Closed] Undo and spinners
Page 2 / 2
Prev
Mar 04, 2016 6:54 pm
It seems I’ve got it!
This code works for me. Can anyone please tell me what can be wrong with it?
(
try (destroydialog ::RO_COLOR) catch()
rollout RO_COLOR "Undo ColorPicker" width:162 height:100
(
colorPicker cp_color "Wire Color " color:(color 255 255 255) enabled:true modal:false offset:[10, 25]
local theGeomNodes = #()
local RO_Timer = dotnetobject "System.Windows.Forms.Timer"
local ColorDlgHwnd
fn Hold mAction mString: =
(
case mAction of
(
#start: if not thehold.holding() do thehold.begin()
#accept: if thehold.holding() do thehold.accept mString
#cancel: if thehold.holding() do thehold.cancel()
)
)
fn getColorDlgHwnd =
(
RO_COLOR.ColorDlgHwnd = DialogMonitorOPS.GetWindowHandle()
true
)
fn SelectGeometry =
(
if (not RO_Timer.enabled) do
(
RO_Timer.start()
Hold #start
theGeomNodes = for o in selection where (isKindOf o GeometryClass) collect o
DialogMonitorOPS.Enabled = false
DialogMonitorOPS.UnRegisterNotification id:#P3D
)
)
fn ColorDlgClosed s e =
(
if not (UIAccessor.isWindow (ColorDlgHwnd)) do
(
Hold #accept mString:"WireColor Change"
s.Stop()
DialogMonitorOPS.Enabled = true
DialogMonitorOPS.RegisterNotification getColorDlgHwnd id:#P3D
)
)
on RO_COLOR open do
(
RO_Timer.Interval = 200
dotnet.addEventHandler RO_Timer "Tick" ColorDlgClosed
DialogMonitorOPS.Enabled = true
DialogMonitorOPS.RegisterNotification getColorDlgHwnd id:#P3D
)
on RO_COLOR close do
(
RO_Timer.Dispose()
DialogMonitorOPS.Enabled = false
DialogMonitorOPS.UnRegisterNotification id:#P3D
)
on cp_color changed new_col do
(
SelectGeometry()
theGeomNodes.wireColor = new_col
)
)
createdialog RO_COLOR
)
Page 2 / 2
Prev