CreateGadget | ||||||||||||||||||||||||||||||
Syntax: | ||||||||||||||||||||||||||||||
CreateGadget(Id.l, ClassName.s, Text.s, Style.l, X.l, Y.l, CX.l, CY.l[,ExStyle.l[,DestroyProc.l[,*vt.PB_GadgetVT]]]) | ||||||||||||||||||||||||||||||
Parameters: | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||
Return Values: | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||
Description: | ||||||||||||||||||||||||||||||
register and create the user defined Gadget | ||||||||||||||||||||||||||||||
Example: | ||||||||||||||||||||||||||||||
; Structure for Gadgetfunctions Structure PB_GadgetVT GadgetType.l SizeOf.l GadgetCallback.l FreeGadget.l GetGadgetState.l SetGadgetState.l GetGadgetText.l SetGadgetText.l AddGadgetItem2.l AddGadgetItem3.l RemoveGadgetItem.l ClearGadgetItemList.l ResizeGadget.l CountGadgetItems.l GetGadgetItemState.l SetGadgetItemState.l GetGadgetItemText.l SetGadgetItemText.l OpenGadgetList2.l GadgetX.l GadgetY.l GadgetWidth.l GadgetHeight.l HideGadget.l AddGadgetColumn.l RemoveGadgetColumn.l GetGadgetAttribute.l SetGadgetAttribute.l GetGadgetItemAttribute2.l SetGadgetItemAttribute2.l SetGadgetColor.l GetGadgetColor.l SetGadgetItemColor2.l GetGadgetItemColor2.l SetGadgetItemData.l GetGadgetItemData.l EndStructure If LoadLibrary_("Scintilla.dll") = #False : MessageRequester("", "Scintilla.dll nicht gefunden") : End : EndIf Procedure MySciEdit(Gadget, x, y, width, height) ProcedureReturn CreateGadget(Gadget, "Scintilla", "", #WS_CHILD | #WS_VISIBLE, x, y, width, height) EndProcedure Procedure MyStatic(Gadget, x, y, width, height, Text.s) ProcedureReturn CreateGadget(Gadget, "Static", Text, #WS_CHILD|#WS_VISIBLE|#SS_CENTER|#SS_SUNKEN, x, y, width, height) EndProcedure Procedure MyButton(Gadget, x, y, width, height, Text.s) ProcedureReturn CreateGadget(Gadget, "Button", Text, #WS_CHILD | #WS_VISIBLE, x, y, width, height) EndProcedure If OpenWindow(0, #PB_Ignore, 0, 250, 480, "Test") CreateGadgetList(WindowID(0)) MySciEdit(0, 0, 0, 250, 400) MyButton(1, 10, 440, 50, 25, "Button 1") GadgetToolTip(1, "Button 1") MyButton(2, 70, 440, 50, 25, "Button 2") GadgetToolTip(2, "Button 2") btn3 = MyButton(#PB_Any, 130, 440, 50, 25, "Button 3") GadgetToolTip(btn3, "Button 3") MyButton(4, 190, 440, 50, 25, "") GadgetToolTip(4, "Button 4") MyStatic(5, 10, 410, 50, 20, "Label 1") MyStatic(6, 70, 410, 50, 20, "Label 2") MyStatic(7, 130, 410, 50, 20, "Label 3") MyStatic(8, 190, 410, 50, 20, "Label 4") SetGadgetText(0, "Feel the ..Pure.. Power") SetGadgetText(4, "Button 4") EndIf Repeat Select WaitWindowEvent() Case #PB_Event_CloseWindow Break Case #PB_Event_Gadget Select EventGadget() Case 1 Debug "Button 1" If GetGadgetText(1) = "Button 1" SetGadgetText(1, "PushMe") Else SetGadgetText(1, "Button 1") EndIf Case 2 Debug "Button 2" Debug GetGadgetText(0) Case btn3 Debug "Button 3" Case 4 Debug "Button 4" EndSelect EndSelect ForEver | ||||||||||||||||||||||||||||||
|