Page 1 of 1

Label Controls

Posted: Sat Nov 24, 2007 2:41 am
by michaeled314
How would you replicate a Visual Basic Label Control in PB

Posted: Sat Nov 24, 2007 3:30 am
by netmaestro
TextGadget()

Posted: Sat Nov 24, 2007 2:05 pm
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).

Posted: Sat Nov 24, 2007 2:08 pm
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