Semi-transparent window and transparent ListIconGadget:
Code: Select all
Define Alpha.CGFloat = 0.8
OpenWindow(0, 200, 100, 430, 95, "ListIcon Example")
ListIconGadget(0, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 20, "Name", 110)
AddGadgetColumn(0, 1, "Address", GadgetWidth(0) - GetGadgetItemAttribute(0, 0, #PB_ListIcon_ColumnWidth))
AddGadgetItem(0, -1, "Harry Rannit" + #LF$ + "12 Parliament Way, Battle Street, By the Bay")
AddGadgetItem(0, -1, "Ginger Brokeit"+ #LF$ + "130 PureBasic Road, BigTown, CodeCity")
AddGadgetItem(0, -1, "Didi Foundit"+ #LF$ + "321 Logo Drive, Mouse House, Downtown")
CocoaMessage(0, WindowID(0), "setOpaque:", #NO)
CocoaMessage(0, WindowID(0), "setAlphaValue:@", @Alpha)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Window with background image and transparent ListIconGadget:
Code: Select all
UseJPEGImageDecoder()
OpenWindow(0, 200, 100, 430, 300, "Window with background image + transparent ListIcon")
ListIconGadget(0, 10, 100, WindowWidth(0) - 20, 75, "Name", 110)
AddGadgetColumn(0, 1, "Address", GadgetWidth(0) - GetGadgetItemAttribute(0, 0, #PB_ListIcon_ColumnWidth))
AddGadgetItem(0, -1, "Harry Rannit" + #LF$ + "12 Parliament Way, Battle Street, By the Bay")
AddGadgetItem(0, -1, "Ginger Brokeit"+ #LF$ + "130 PureBasic Road, BigTown, CodeCity")
AddGadgetItem(0, -1, "Didi Foundit"+ #LF$ + "321 Logo Drive, Mouse House, Downtown")
If LoadImage(0, #PB_Compiler_Home + "Examples/3D/Data/Textures/Clouds.jpg")
ContentView = CocoaMessage(0, WindowID(0), "contentView")
CocoaMessage(0, ContentView, "setWantsLayer:", #YES)
Layer = CocoaMessage(0, ContentView, "layer")
CocoaMessage(0, Layer, "setContents:", ImageID(0))
EndIf
CocoaMessage(0, GadgetID(0), "setBackgroundColor:", CocoaMessage(0, 0, "NSColor clearColor"))
CocoaMessage(0, CocoaMessage(0, GadgetID(0), "enclosingScrollView"), "setDrawsBackground:", #NO)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Update: In the first example I had to change the declaration of variable Alpha from Float to CGFloat in order to run correctly in 32 and 64 environments (Thank you for your hint, wilbert!).