SkinGetData

Syntax

Success = SkinGetData(Path$, State$, Component$, Property$, *ValueData.Integer, *ValueType.Integer=#Null, *ValueSize.Integer=#Null, Skin=#Null)

Description

Retrieves the internal data structure associated with a specific skin property for a given selector path, state, and component. This provides access to the parsed, typed representation of the skin value.

Parameters

Path$
The widget class selector path (e.g., "window.button", "mylistview").

State$
The widget state (e.g., "", "hover", "active"). An empty string targets the base state.

Component$
The specific component within the widget (e.g., "", "thumb"). An empty string targets the main element.

Property$
The name of the skin property to retrieve (e.g., "background-color", "border", "transition").

*ValueData.Integer
A pointer to an Integer variable that will receive the memory address (pointer) of the internal data structure holding the parsed value for the property. The actual structure type depends on the property (e.g., SkinValueBackground, SkinValueBorder, SkinValueColor, SkinValueTransition).

*ValueType.Integer (optional)
A pointer to an Integer variable that will receive the type constant of the retrieved data (e.g., #PG_Skin_Type_Background, #PG_Skin_Type_Border, etc.). Default is #Null.

*ValueSize.Integer (optional)
A pointer to an Integer variable that will receive the size in bytes of the retrieved data structure. Default is #Null.

Skin (optional)
The handle of the skin object to query. If #Null, the current default skin is used. Default is #Null.

Return Value

Returns #True if the specified property was found for the given path/state/component in the skin. Returns #False otherwise (e.g., property not found, skin invalid). If successful, *ValueData will contain the pointer to the data structure, and *ValueType and *ValueSize (if provided) will be filled accordingly.

Remarks

This function provides low-level access to the parsed skin data. You need to know the expected data type (based on the `Property$`) to correctly cast the pointer received in `*ValueData` and interpret its contents. For common types like colors, using convenience functions like SkinGetColor() or WidgetGetSkinColor() is generally easier. This function accesses the skin cache if possible.

Example

IncludeFile "ProGUI_PB.pbi"
; Define structure matching SkinValueColor (adjust if internal structure changes)
Structure MyColorData
color.l
opacity.d
red.d
green.d
blue.d
EndStructure

StartProGUI()

; Assume a skin is loaded or created and set as default
SkinSetValue("mywidget", "", "", "color", "rgba(255, 0, 0, 0.5)") ; Semi-transparent red

MyWindow = CreateWindow(0, 0, 300, 200, "Get Skin Data")
MyWidget = CreateWidget(10,10,100,30)
WidgetSetClass(MyWidget, "mywidget")

If MyWindow
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)

      
If SkinGetData("mywidget", "", "", "color", @DataPtr, @DataType, @DataSize)
    Debug "Data Found!"
    Debug "  Type: " + DataType  ; Should match #PG_Skin_Type_Color
    Debug "  Size: " + DataSize  ; Should match SizeOf(SkinValueColor)

    If DataType = #PG_Skin_Type_Color
        *ColorInfo.MyColorData = DataPtr
        Debug "  Color (Hex): " + Hex(*ColorInfo\color)
        Debug "  Opacity: " + StrF(*ColorInfo\opacity, 2)
        Debug "  RGB: (" + Int(*ColorInfo\red) + ", " + Int(*ColorInfo\green) + ", " + Int(*ColorInfo\blue) + ")"
    EndIf
Else
    Debug "Skin data for 'mywidget:color' not found."
EndIf

Repeat : Event = WaitWindowEvent() : Until Event = #PB_Event_CloseWindow
EndIf

StopProGUI()

See Also

SkinGetValue, SkinGetColor, WidgetGetSkinData (preferred method inside widget handlers), SkinSetValue

Supported OS

Windows, Linux