Label Controls

Just starting out? Need help? Post your questions and find answers here.
michaeled314
Enthusiast
Enthusiast
Posts: 340
Joined: Tue Apr 24, 2007 11:14 pm

Label Controls

Post by michaeled314 »

How would you replicate a Visual Basic Label Control in PB
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

TextGadget()
BERESHEIT
User avatar
dhouston
Enthusiast
Enthusiast
Posts: 430
Joined: Tue Aug 21, 2007 2:44 pm
Location: USA (Cincinnati)
Contact:

Post by dhouston »

TextGadget is close but it's not 100% identical as VB labels receive events while TextGadgets do not. If you need it clickable, I think you need a StringGadget (with #PB_String_ReadOnly).
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post by milan1612 »

...or add #SS_NOTIFY to the flags (windows only)

Edit:

Code: Select all

If OpenWindow(0, 0, 0, 130, 25, "TextGadget Events", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  If CreateGadgetList(WindowID(0))
    TextGadget(1, 5, 5, 120, 18, "See? I'm clickable...", #SS_NOTIFY)

    Repeat
      Event = WaitWindowEvent()
      Select Event
        Case #PB_Event_CloseWindow : Break
        Case #PB_Event_Gadget
          If EventGadget() = 1
            MessageRequester("Event", "TextGagdet Event received...")
          EndIf 
      EndSelect
    ForEver
    End
  EndIf
EndIf
Windows 7 & PureBasic 4.4
Post Reply