123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- .. _func_maxgui_panels_createpanel:
- ===========
- CreatePanel
- ===========
- CreatePanel -
- Description
- ===========
- .. code-block:: blitzmax
- CreatePanel:TGadget(x,y,w,h,group:TGadget,style=0,title$="")
- Create a Panel gadget.
- A Panel is a general purpose gadget that can be used to group other gadgets,
- it has background color and pixmap properties.
- A panel can feature the following optional styles:
- [ @Style | @Meaning
- * PANEL_BORDER | Panel is drawn with a border.
- * PANEL_ACTIVE | Panel generates mouse move events.
- * PANEL_GROUP | Panel is drawn with a titled etched border.
- ]
- If the PANEL_ACTIVE style flag is specified, the Panel will emit the following
- mouse and key events:
- [ @{Event ID} | @Description
- * EVENT_MOUSEDOWN | Mouse button pressed. Event data contains mouse button code.
- * EVENT_MOUSEUP | Mouse button released. Event data contains mouse button code.
- * EVENT_MOUSEMOVE | Mouse moved. Event x and y contain mouse coordinates.
- * EVENT_MOUSEWHEEL | Mouse wheel spun. Event data contains delta clicks.
- * EVENT_MOUSEENTER | Mouse entered gadget area.
- * EVENT_MOUSELEAVE | Mouse left gadget area.
- * EVENT_KEYDOWN | Key pressed. Event data contains keycode.
- * EVENT_KEYUP | Key released. Event data contains keycode.
- * EVENT_KEYCHAR | Key character. Event data contains unicode value.
- ]
- %{Note: The PANEL_BORDER and PANEL_GROUP style flags cannot be used together.}
- See Also: #SetPanelColor and #SetPanelPixmap.
- Parameters
- ==========
- Return Values
- =============
- Nothing.
- Examples
- ========
- .. code-block:: blitzmax
- ' createpanel.bmx
-
- Import MaxGui.Drivers
-
- Strict
-
- Local window:TGadget
- Local panel:TGadget
- Local panel2:TGadget
- Local group:TGadget
-
- window=CreateWindow("My Window",40,40,320,240)
-
- ' create a purple panel that occupies entire window client area
-
- panel=CreatePanel(0,0,ClientWidth(window),ClientHeight(window),window,PANEL_ACTIVE)
- SetGadgetLayout panel,1,1,1,1
- 'SetPanelColor panel,100,0,200
-
- ' and a smaller box
-
- panel2=CreatePanel(10,10,100,100,panel,PANEL_ACTIVE|PANEL_BORDER)
- panel2.SetColor(160,255,160)
-
- ' and a group panel with a child button
-
- group=CreatePanel(120,10,100,100,panel,PANEL_GROUP)
- group.settext("My Group")
- CreateButton("hello",0,0,64,24,group)
-
-
- While True
- WaitEvent
- Print CurrentEvent.ToString()
- Select EventID()
- Case EVENT_WINDOWCLOSE
- End
- End Select
- Wend
- See Also
- ========
|