HyperLinkGadget in ListIconGadget [Windows]

Share your advanced PureBasic knowledge/code with the community.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4042
Joined: Sun Apr 12, 2009 6:27 am

HyperLinkGadget in ListIconGadget [Windows]

Post by RASHAD »

The Title say it all

Code: Select all

  LoadFont(0,"Tahoma",12)
  
  OpenWindow(0, 0, 0, 640, 300, "ListIconGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)      
      ListIconGadget(0, 10,  25, 620, 250, "", 0,#PB_ListIcon_FullRowSelect| #WS_CLIPSIBLINGS)
      SendMessage_(GadgetID(0),#LVM_SETEXTENDEDLISTVIEWSTYLE,#LVS_EX_GRIDLINES,#LVS_EX_GRIDLINES)
      SetGadgetColor(0,#PB_Gadget_BackColor,$DCFFFF)
      For b = 1 To 6
        AddGadgetColumn(a, b, "Column " + Str(b), 130)
      Next
      For b = 0 To 6 
        AddGadgetItem(a, b, "Item 1"+Chr(10)+"Item 1"+Chr(10)+"Item 2"+Chr(10)+"Item 3"+Chr(10)+"Item 4"+Chr(10)+"Item 5"+Chr(10)+"Item 6")
      Next
      
      SetGadgetFont(0,FontID(0))
      
      SetGadgetItemText(0,0,"Link Test #1",1)
      SetGadgetItemText(0,2,"Link Test #2",3)
      SetGadgetItemText(0,4,"Link Test #3",2)
      
      HyperLinkGadget(1, 0,0,0,0,"",$FF0000, #PB_HyperLink_Underline | #WS_CLIPSIBLINGS)
      SetGadgetColor(1,#PB_Gadget_BackColor,GetGadgetColor(0,#PB_Gadget_BackColor))
      BringWindowToTop_(GadgetID(1))
      SetGadgetFont(1,FontID(0))
      
Repeat
  Select WaitWindowEvent()
      
      Case #PB_Event_CloseWindow
            Quit = 1
       

      Case #PB_Event_Gadget
          Select EventGadget()
           Case 1
                 If GetGadgetText(1) = "Link Test #1"
                     Debug "OK # 1"
                 ElseIf GetGadgetText(1) = "Link Test #2"
                     Debug "OK # 2"
                 ElseIf GetGadgetText(1) = "Link Test #3"
                     Debug "OK # 3"
                 EndIf            
          EndSelect          
          
      Case #WM_SIZE
          
      Case #WM_MOUSEMOVE
            GetCursorPos_(@p.POINT)
            ScreenToClient_(GadgetID(0),p)
            li.LVHITTESTINFO
            li\pt\x = p\x
            li\pt\y = p\y
            SendMessage_(GadgetID(0),#LVM_SUBITEMHITTEST ,0,li)
            
            If li\iItem <> Olditem Or li\iSubItem <> Oldsubitem
                If li\iItem = 0 And li\iSubItem = 1
                    SetGadgetText(1,"Link Test #1")
                ElseIf li\iItem = 2 And li\iSubItem = 3
                    SetGadgetText(1,"Link Test #2")
                ElseIf li\iItem = 4 And li\iSubItem = 2
                    SetGadgetText(1,"Link Test #3")
                EndIf                
                If (li\iItem = 0 And li\iSubItem = 1) Or (li\iItem = 2 And li\iSubItem = 3) Or (li\iItem = 4 And li\iSubItem = 2)
                    r.RECT 
                    r\top = li\iSubItem 
                    r\left = #LVIR_BOUNDS 
                    SendMessage_(GadgetID(0), #LVM_GETSUBITEMRECT, li\iItem, r)
                    MoveWindow_(GadgetID(1),r\left+GadgetX(0)+8,r\top+GadgetY(0)+4,r\right-r\left-2,r\bottom-r\top,1)
                Else 
                    MoveWindow_(GadgetID(1),0,0,0,0,1)
                EndIf            
            EndIf
                        
            Olditem = li\iItem
            Oldsubitem = li\iSubItem
             
  EndSelect 

Until Quit = 1
End

Egypt my love
User avatar
electrochrisso
Addict
Addict
Posts: 979
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: HyperLinkGadget in ListIconGadget [Windows]

Post by electrochrisso »

8)
PureBasic Rocks! Even More! And More!
PureBasic 5, Now We're Really Rockin!
Post Reply