PtWidgetToBack, PtWidgetToFront — moves a widget behind or in front of others.
PtWidgetToBack (widget) PtWidgetToFront (widget)
These functions move the widget, and any of its children, behind or in front of all of the other widgets that are inside the same container.
This example, ex_PtWidgetToBack.g, is included in the product distribution.
#!/usr/cogent/bin/phgamma /* This example creates a window with three colored rectangles and three buttons that move them to front and back. */ require_lisp("PhotonWidgets"); PtInit(nil); win = new(PtWindow); win.SetDim(300,200); RectA = new(PtRect); RectA.fill_color = PgRGB(255,0,0); RectA.SetPos(140,45); RectA.SetDim(100,80); RectB = new(PtRect); RectB.fill_color = PgRGB(0,150,120); RectB.SetPos(70,60); RectB.SetDim(80,70); RectC = new(PtRect); RectC.fill_color = PgRGB(0,30,220); RectC.SetPos(110,20); RectC.SetDim(90,90); butA = new(PtButton); butB = new(PtButton); butC = new(PtButton); butA.text_string = "Red"; butB.text_string = "Green"; butC.text_string = "Blue"; butA.SetPos(55,100); butB.SetPos(115,100); butC.SetPos(175,100); Instructions = new(PtLabel); Instructions.text_string = "Hold moves to front, release moves to back."; Instructions.SetPos(10,150); PtAttachCallback(butA, Pt_CB_ARM, #PtWidgetToFront(RectA)); PtAttachCallback(butB, Pt_CB_ARM, #PtWidgetToFront(RectB)); PtAttachCallback(butC, Pt_CB_ARM, #PtWidgetToFront(RectC)); PtAttachCallback(butA, Pt_CB_DISARM, #PtWidgetToBack(RectA)); PtAttachCallback(butB, Pt_CB_DISARM, #PtWidgetToBack(RectB)); PtAttachCallback(butC, Pt_CB_DISARM, #PtWidgetToBack(RectC)); PtRealizeWidget(win); PtMainLoop();
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.