If PropColor(Str(Gadget))\TextColor = #PB_Auto If PropColor(Str(Gadget))\BackColor = #PB_AutoīackColor = PropColor(Str(Gadget))\BackColor Protected Gadget, BackColor, FrontColor, hdc If there are used brushes in other windows, they will be recreated Debug "Delete Map Element Gadget: " + MapKey(PropColor()) If Not(IsGadget(Val(MapKey(PropColor())))) PB_Object_EnumerateNext(PB_Objects, *ID.Integer) For all gadgets with automatic background color and text color use: CheckOptionColor() #PB_Default: to go back to the default system text color RGB() can be used to get a valid color value TextColor: #PB_Auto = White or Black depending on whether the background color is dark or light (Default) #PB_Default = to go back to the default system backgound color BackColor: #PB_Auto = Same as parent container's color (Default) #Gadget: #PB_All = All Option and CheckBox Gadgets (Default) Add: #Window]) to associates a callback to all open windows or for a specific window only Description: Set Background and Text Colors of OptionGadget() and CheckBoxGadget() automatically based on the parent container's color or on the colors passed in parameters CheckOptionColor(#Check2, #White, #Red) "White/Red"ĬheckBoxGadget(#Check3, 180, 100, 140, 30, "Black/Green or Default")ĬheckOptionColor(#Check3, #Black, #Green)ĬheckOptionColor(#Check3, #PB_Default, #PB_Default) Remove PropertiesĬode: Select all. OptionGadget(#Option1, 20, 20, 140, 30, "Black/Yellow")ĬheckOptionColor(#Option1, #Black, #Yellow) SetWindowTheme_(GadgetID(Gadget), #PB_Any, #PB_Any, 340, 150, "Option and CheckBox Color", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) PropColor(Str(Gadget))\TextColor = TextColor PropColor(Str(Gadget))\BackColor = BackColor If BackColor = #PB_Default And TextColor = #PB_DefaultĭeleteMapElement(PropColor(), Str(Gadget)) If GadgetType(Gadget) = #PB_GadgetType_CheckBox Or GadgetType(Gadget) = #PB_GadgetType_Option If Not(IsGadget(Gadget)) : ProcedureReturn : EndIf Procedure CheckOptionColor(Gadget, BackColor = #PB_Default, TextColor = #PB_Default) ProcedureReturn CreateSolidBrush_(PropColor(Str(Gadget))\BackColor) SetTextColor_(wParam, PropColor(Str(Gadget))\TextColor) If FindMapElement(PropColor(), Str(Gadget)) Protected Gadget, Result = #PB_ProcessPureBasicEvents If LoadImage(0, #PB_Compiler_Home + "/Examples/Sources/Data/PureBasic.Procedure MainWindow_Callback(hWnd, uMsg, wParam, lParam) #PB_Button_PressedImage: Set the image displayed when the button is pressed.Įxample If OpenWindow(0, 0, 0, 200, 60, "ButtonImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) #PB_Button_Image : Set the displayed image. SetGadgetAttribute() with the following values: #PB_Button_PressedImage: Get the displayed image ID when the button is pressed, e.g. #PB_Button_Image : Get the displayed image ID, e.g. GetGadgetAttribute() with the following values: SetGadgetState() can be used to set the toggle state of the gadget. GetGadgetState() can be used to get the toggle state of the gadget. The following functions can be used to control the gadget: Then the return-value is the auto-generated gadget number on success.Ī 'mini help' can be added to this gadget using GadgetToolTip(). If #PB_Any was used as the #Gadget parameter Returns nonzero on success and zero on failure. This parameter can be #PB_Button_Toggle to create a toggle-button (one which has an on/off state). The SetGadgetAttribute()įunction can be used to change the image later. This parameter can be zero to create a button without an image. Use the ImageID() function to get this ID from an image. The position and dimensions of the new gadget. Result = ButtonImageGadget(#Gadget, x, y, Width, Height, ImageID ) DescriptionĬreate a button gadget with an image in the current GadgetList.Ī number to identify the new gadget.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |