Treat windows or at least window identities as first class objects.

 Store window identities in variables, compare them for equality.
 Provide examples of performing some of the following:
 hide, 
 show, 
 close, 
 minimize, 
 maximize, 
 move,     and 
 resize a window. 


The window of interest may or may not have been created by your program.




-- demo\rosetta\Window_management.exw
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()
 
    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)
    if platform()!=JS then
        IupMainLoop()
        IupClose()
    end if
end procedure
main()
