Page 1 of 1

Fancy Panel Gadget (Windows)

Posted: Thu Sep 29, 2011 6:05 pm
by RASHAD
Optitions are unlimited
You can use Imag ButtonGadget instead with different images
Tested with PB 4.6 x86 - Windows 7 x64
Have fun

Code: Select all


Global SG
Global Dim x(6)
x(1) = 0
x(2) = 46
x(3) = 92
x(4) = 138

  If OpenWindow(0, 0, 0, 400, 300, "Fancy PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    PanelGadget(100, 10, 10, 380, 280)
      AddGadgetItem (100, -1, "Panel 1")
      AddGadgetItem (100, -1,"Panel 2")
        ButtonGadget(101, 10, 15, 80, 24,"Button 1")
        ButtonGadget(102, 95, 15, 80, 24,"Button 2")
      AddGadgetItem (100, -1,"Panel 3")
      AddGadgetItem (100, -1,"Panel 4")
    CloseGadgetList()
    ContainerGadget(0, 10, 6,210, 26,#PB_Container_BorderLess)
      ButtonGadget(1, 0, 5, 48, 24,"Panel 0",#BS_FLAT)
      ButtonGadget(2, 46, 5,48, 24,"Panel 1",#BS_FLAT)
      ButtonGadget(3, 92, 5, 48, 24,"Panel 2",#BS_FLAT)
      ButtonGadget(4, 138, 5, 48, 24,"Panel 3",#BS_FLAT)
    CloseGadgetList()
    BringWindowToTop_(GadgetID(0))
    
    Import "Uxtheme.lib"
        SetWindowTheme(Window.l, Body.p-unicode, Title.p-unicode)                                                  
    EndImport        
    SG = 4
    Run = 1
  Repeat
      Select WaitWindowEvent()
      
        Case #PB_Event_CloseWindow
            Quit = 1
      
        Case #PB_Event_Gadget
          Select EventGadget()
                     
          EndSelect
          
        Case #WM_MOUSEMOVE         
          GetCursorPos_ (@p.POINT) 
          ScreenToClient_ (WindowID(0), @p)            
          Select ChildWindowFromPoint_ (GadgetID(0), p\y<< 32+p\x)
              Case GadgetID(1)
                If SG <> 1            
                  ResizeGadget(SG,x(SG),5 ,48 ,24)
                  SetWindowTheme(GadgetID(SG),"", "BUTTON")
                  ResizeGadget(1,0,0 ,48 ,28)
                  SetWindowTheme(GadgetID(1),"", "WINDOW")
                  SetGadgetState(100,0)
                EndIf 
                  SG = 1                                    
              Case GadgetID(2)
                If SG <> 2
                  ResizeGadget(SG,x(SG),5 ,48 ,24)
                  SetWindowTheme(GadgetID(SG),"", "BUTTON")
                  ResizeGadget(2,46,0 ,48 ,28)
                  SetWindowTheme(GadgetID(2),"", "WINDOW")
                  SetGadgetState(100,1)
                EndIf 
                  SG = 2
              Case GadgetID(3)
                If SG <> 3
                  ResizeGadget(SG,x(SG),5 ,48 ,24)
                  SetWindowTheme(GadgetID(SG),"", "BUTTON")
                  ResizeGadget(3,92,0 ,48 ,28)
                  SetWindowTheme(GadgetID(3),"", "WINDOW")
                  SetGadgetState(100,2)
                EndIf 
                  SG = 3
              Case GadgetID(4)
                If SG <> 4 Or Run = 1
                  ResizeGadget(SG,x(SG),5 ,48 ,24)
                  SetWindowTheme(GadgetID(SG),"", "BUTTON")
                  ResizeGadget(4,138,0 ,48 ,28)
                  SetWindowTheme(GadgetID(4),"", "WINDOW")
                  SetGadgetState(100,3)
                  Run = 0
                EndIf 
                  SG = 4
              EndSelect

              
              
                
      EndSelect
      
  Until Quit = 1
  EndIf

Re: Fancy Panel Gadget (Windows)

Posted: Thu Sep 29, 2011 6:53 pm
by falsam
Good Job RASHAD, very good :)

Re: Fancy Panel Gadget (Windows)

Posted: Fri Sep 30, 2011 7:19 am
by RASHAD
@falsam Hi
Thanks mate
You are the author of PB Contribution
Feel free my friend to add any of my posts you like
I will be honored

Thanks mate

Re: Fancy Panel Gadget (Windows)

Posted: Sat Oct 01, 2011 7:33 pm
by Kwai chang caine
Wouuaaauuhh again a great code of the PB magician :shock:
Thanks for sharing 8)

Re: Fancy Panel Gadget (Windows)

Posted: Sat Oct 01, 2011 10:25 pm
by IdeasVacuum
By the powers invested upon me as Chief Bug Maker, I hereby bestow upon you the title Rashad, Pharaoh of Tricks n Tips.