Window management: Difference between revisions

No edit summary
Line 655:
 
Doubtless some more modern Tk binding (such as Tkx, or perhaps Tcl::Tk) would handle that better.
 
=={{header|Phix}}==
{{trans|Nim}}
Included in the distribution as demo\rosetta\Window_management.exw
<lang Phix>include pGUI.e
 
Ihandle dlg
 
function doFull(Ihandle /*ih*/)
IupSetAttribute(dlg,"FULLSCREEN","YES")
return IUP_DEFAULT
end function
function doMax(Ihandle /*ih*/)
IupSetAttribute(dlg,"PLACEMENT","MAXIMIZED")
-- this is a work-around to get the dialog minimised (on win platform)
IupSetAttribute(dlg,"VISIBLE","YES")
return IUP_DEFAULT
end function
function doMin(Ihandle /*ih*/)
IupSetAttribute(dlg,"PLACEMENT","MINIMIZED")
-- this is a work-around to get the dialog minimised (on win platform)
IupSetAttribute(dlg,"VISIBLE","YES")
return IUP_DEFAULT
end function
function doRestore(Ihandle /*ih*/)
IupSetAttribute(dlg,"OPACITY","255")
IupSetAttribute(dlg,"FULLSCREEN","NO")
IupSetAttribute(dlg,"PLACEMENT","NORMAL")
IupSetAttribute(dlg,"VISIBLE","YES")
return IUP_DEFAULT
end function
function doDim(Ihandle /*ih*/)
IupSetAttribute(dlg,"OPACITY","60")
return IUP_DEFAULT
end function
function doShow(Ihandle /*ih*/)
IupSetAttribute(dlg,"OPACITY","255")
return IUP_DEFAULT
end function
 
function doMove(Ihandle /*ih*/)
integer {x,y} = IupGetIntInt(dlg,"SCREENPOSITION")
integer shift = iff(IupGetInt(NULL,"SHIFTKEY")?-10,+10)
IupShowXY(dlg,x+shift,y+shift)
return IUP_DEFAULT
end function
procedure main()
IupOpen("../pGUI/")
Ihandle hbox = IupHbox({IupButton("restore", Icallback("doRestore")),
IupButton("full screen",Icallback("doFull")),
IupButton("maximize", Icallback("doMax")),
IupButton("minimize", Icallback("doMin")),
IupButton("dim", Icallback("doDim")),
IupButton("show", Icallback("doShow")),
IupButton("move", Icallback("doMove"))})
IupSetAttribute(hbox,"MARGIN", "10x10")
IupSetAttribute(hbox,"PADDING", "5x5")
dlg = IupDialog(hbox)
IupSetAttribute(dlg,"OPACITY","255")
IupShowXY(dlg,IUP_CENTER,IUP_CENTER)
IupMainLoop()
IupClose()
end procedure
main()</lang>
 
=={{header|PicoLisp}}==
7,818

edits