Show/Hide underlined letters And focus rectangle[Window]

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

Show/Hide underlined letters And focus rectangle[Window]

Post by RASHAD »

The simpelist way
Show or Hide underlined letters For keyboard navigation And gadget focus rectangle
Even with XP theme enabled
Windows XP x86 ,Vista x86,Windows 7 x86 x64 PB x86 x64

Code: Select all

;{                                                                        Must be before Open any window
Global Pv.l
#SPI_SETKEYBOARDCUES = $100B

SystemParametersInfo_(#SPI_GETKEYBOARDCUES, 0, @Pv, 0)                   ;Get the current status for the running system
SystemParametersInfo_(#SPI_SETKEYBOARDCUES, 0, 1, 0)                     ;Show underlined letters for keyboard navigation and gadget focus rectangle
;SystemParametersInfo_(#SPI_SETKEYBOARDCUES, 0, 0, 0)                    ;Hide underlined letters for keyboard navigation and gadget focus rectangle
;}
OpenWindow(0, 100, 100, 220, 180, "Tab Test", #PB_Window_SystemMenu)
  If CreateMenu(0, WindowID(0))
    MenuTitle("&Project") 
    MenuItem(1, "&Open"   +Chr(9)+"Ctrl+O") 
    MenuItem(2, "&Save"   +Chr(9)+"Ctrl+S") 
    MenuItem(3, "Save &As"+Chr(9)+"Ctrl+A") 
    MenuItem(4, "&Close"  +Chr(9)+"Ctrl+C") 
  EndIf 
  StringGadget(0, 10, 10, 200, 20, "") 
  CheckBoxGadget(1, 10, 40,200, 20, "&CheckBox1")
  ButtonGadget(2, 10, 70, 200, 20, "Button&1") 
  StringGadget(3, 10, 100, 200, 20, "") 
  ButtonGadget(4, 10, 130, 200, 20, "Button&2")
  SetActiveGadget(0)
  
  Repeat 
   EventID = WaitWindowEvent()
   
   Select EventID

    Case #PB_Event_Gadget
    
     Select EventGadget()
     
           Case 2
            MessageRequester("","Button1 pressed", #MB_ICONERROR)                 
                
     EndSelect
     
    Case #PB_Event_CloseWindow      
        ;{                                                                      To set the system to it's default
        If Pv = 0
            SystemParametersInfo_(#SPI_SETKEYBOARDCUES, 0, 0, 0)
        EndIf
        ;}
        Quit = 1
             
  EndSelect
         
Until Quit = 1

End 
Last edited by RASHAD on Sat Jan 16, 2010 10:04 am, edited 4 times in total.
Egypt my love
User avatar
Blue Steel
Enthusiast
Enthusiast
Posts: 132
Joined: Wed Aug 31, 2005 4:49 pm
Contact:

Re: Show/Hide underlined letters And focus rectangle[Window]

Post by Blue Steel »

Thanks , I'll add it to MyWindows Gadget demo program
....
Added and working great ;)
Currently using PureBasic 4.51(x86)

Image http://www.codingmonkeys.com
Covers many languages including PureBasic
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4953
Joined: Sun Apr 12, 2009 6:27 am

Re: Show/Hide underlined letters And focus rectangle[Window]

Post by RASHAD »

@Blue Steel Hi
Thank you for your response
I am glad that you find it useful

I Updated the first post to show the functionality
1- Tab to select the control
2- Spacebar to fire the selected
Egypt my love
Post Reply