PureBasic Forum
http://forums.purebasic.com/english/

HyperLink 3DButton
http://forums.purebasic.com/english/viewtopic.php?f=12&t=72183
Page 1 of 1

Author:  VB6_to_PBx [ Thu Jan 31, 2019 8:10 am ]
Post subject:  HyperLink 3DButton

3 examples of using HyperLinkGadget as a 3D Button

the 1st Button example looks the best ( IMO ) ?

Code:
;-< Top >
;-
;-       HyperLink_3DButton.pb
;-
;-       Link :
;-       Post Subject/Date :
;-       PureBasic version : PB 5.41
;-     
;-< Start Program >------------------------------------------------------------
;
;

#Verdana8B = 1
LoadFont(#Verdana8B,"Verdana",8,#PB_Font_Bold)

OpenWindow(1, 0, 0, 270, 160, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    SetWindowColor(1,RGB(160,160,160))

    ;----- this better looking 3D HyperLink Button has thinner outside Frame , along with a Black edge inner Frame Border
    ContainerGadget(1000, 60, 30, 128, 23, #PB_Container_Raised)
         SetGadgetColor(1000, #PB_Gadget_BackColor,RGB(0,0,0))  ;<<--- set a Black edge inner Frame Border
         HyperLinkGadget(1, 1, 1, 128-8,23-8,Space(1)+"HyperLink Button",RGB(255,255,0))
              SetGadgetColor(1,#PB_Gadget_FrontColor,RGB(255,255,255))
              SetGadgetColor(1,#PB_Gadget_BackColor,RGB(0,140,0))
              SetGadgetFont(1, FontID(1))
    CloseGadgetList()

    ;----- this plain looking 3D HyperLink Button has thicker outside Frame , with no Black edge inner Frame Border
    ContainerGadget(2000, 60, 70, 128, 23, #PB_Container_Raised)
         HyperLinkGadget(2, 1, 1, 128-9,23-9,Space(5)+"HyperLink 2",RGB(255,255,0))
              SetGadgetColor(2,#PB_Gadget_FrontColor,RGB(255,255,255))
              SetGadgetColor(2,#PB_Gadget_BackColor,RGB(0,140,0))
              SetGadgetFont(2, FontID(1))
    CloseGadgetList()

    ;----- this plain looking 3D HyperLink Button has thinner outside Frame , with no Black edge inner Frame Border
    ContainerGadget(3000, 60, 110, 128, 22, #PB_Container_Raised)
         HyperLinkGadget(3, 0, 0, 128-7,22-7,Space(5)+"HyperLink 3",RGB(255,255,0))
              SetGadgetColor(3,#PB_Gadget_FrontColor,RGB(255,255,255))
              SetGadgetColor(3,#PB_Gadget_BackColor,RGB(0,140,0))
              SetGadgetFont(3, FontID(1))
    CloseGadgetList()

Repeat
    EW = EventWindow()       ;<<--- In Programs with more than one Form or Window, which Window did the Event occur on.
    WW = WaitWindowEvent()   ;<<--- Wait until a new Window or Gadget Event occurs.
    EG = EventGadget()       ;<<--- Which Gadget did the Event occur on. ( Numerical Number or Constant #Name of the Gadget )
    ET = EventType()         ;<<--- What sort of Event Type occurred.
    EM = EventMenu()         ;<<--- Which Menu did the Event occur on.
    AG = GetActiveGadget()   ;<<--- Get the Active Gadget's Numerical Number or Constant #Name that has the current Focus

    Select EW
    Case 1
         Select WW
         Case #PB_Event_Gadget
              Select EG
              Case 1
                   Select ET
                   Case #PB_EventType_LeftClick : SetWindowTitle(1,"Clicked HyperLink #1") : ;ShellExecute_(0,"open","https://www.purebasic.fr/english/index.php",0,0,#SW_SHOWNORMAL)
                   EndSelect
              Case 2
                   Select ET
                   Case #PB_EventType_LeftClick : SetWindowTitle(1,"Clicked HyperLink #2")
                   EndSelect
              Case 3
                   Select ET
                   Case #PB_EventType_LeftClick : SetWindowTitle(1,"Clicked HyperLink #3")
                   EndSelect
              EndSelect
         EndSelect
    EndSelect
Until WW = #PB_Event_CloseWindow : End

;     #PB_Container_BorderLess : Without any border (Default).
;     #PB_Container_Flat       : Flat frame.
;     #PB_Container_Raised     : Raised frame.
;     #PB_Container_Single     : Single sunken frame.
;     #PB_Container_Double     : Double sunken frame.
;   
;-
;-< End Program >--------------------------------------------------------------


Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/