Extend a Panel In Only One Direction
jjweimer
// Create a panel with a button that will extend the panel size in only one direction (downward in this case).
// The extension is also set at a pre-defined size.
// Features inside the initially hidden extension range can be shown or hidden again using the XtendD button.
Static Constant normaldepth = 80
Static Constant xtendeddepth = 170
Function SamplePanel()
NewPanel/W=(10,25,255,25+normaldepth)/N=XtendablePanel/K=1 as "Xtend Me"
ModifyPanel noEdit=1, fixedsize=1
Button XtendD,pos={4,55},size={15,20},proc=XtendDown,title=">", userData="closed"
SetDrawLayer UserBack
DrawLine 22,65,242,65
CheckBox acheckbox,pos={24,85},size={48,14},title="A Box"
return 0
end
Function XtendDown(ba) : ButtonControl
STRUCT WMButtonAction &ba
switch( ba.eventCode )
case 2: // mouse up
GetWindow kwTopWin wsize
strswitch(ba.userData)
case "closed":
Button XtendD title="v", userData="opened"
MoveWindow V_left,V_top,V_right,V_top+(xtendeddepth*72/ScreenResolution)
break
case "opened":
Button XtendD title=">", userData="closed"
MoveWindow V_left,V_top,V_right,V_top+(normaldepth*72/ScreenResolution)
break
endswitch
break
endswitch
return 0
end
// The extension is also set at a pre-defined size.
// Features inside the initially hidden extension range can be shown or hidden again using the XtendD button.
Static Constant normaldepth = 80
Static Constant xtendeddepth = 170
Function SamplePanel()
NewPanel/W=(10,25,255,25+normaldepth)/N=XtendablePanel/K=1 as "Xtend Me"
ModifyPanel noEdit=1, fixedsize=1
Button XtendD,pos={4,55},size={15,20},proc=XtendDown,title=">", userData="closed"
SetDrawLayer UserBack
DrawLine 22,65,242,65
CheckBox acheckbox,pos={24,85},size={48,14},title="A Box"
return 0
end
Function XtendDown(ba) : ButtonControl
STRUCT WMButtonAction &ba
switch( ba.eventCode )
case 2: // mouse up
GetWindow kwTopWin wsize
strswitch(ba.userData)
case "closed":
Button XtendD title="v", userData="opened"
MoveWindow V_left,V_top,V_right,V_top+(xtendeddepth*72/ScreenResolution)
break
case "opened":
Button XtendD title=">", userData="closed"
MoveWindow V_left,V_top,V_right,V_top+(normaldepth*72/ScreenResolution)
break
endswitch
break
endswitch
return 0
end
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More