1. Treeview Rant !

Hello all,

I found what I consider to be a bug in the Treeview control

consider this bit of code. ->

elsif iMsg = TVN_KEYDOWN then
       vKey = peek(lParam + 12) --struct tagTVKEYDOWN (WORD wVKey)
       if vKey = 9 then                                  
          SetFocus(futurecontrol) 
       elsif vKey = 25 then  -- should be shift+tab    
          SetFocus(previouscontrol)                             
       end if
end if

works really good but what if someone wanted to reverse the taborder direction
for focus purposes? 

shift+tab "or"  shift = 16 + tab = 9  should be vKey = 25
but this control doesnt handle this in the right way thus returning vKey = 9

you cant go backward from a Treeview control, unless someone can provide a
work around...

Euman
euman at bellsouth.net

...if the US Government were ever to get really serious about Internet 
security, the top players in Microsoft's management hierarchy would find 
themselves handcuffed, blindfolded, led onto a tarmac within some obscure 
Air Force base, and shot.
-- Thomas C Greene (http://www.theregister.co.uk/content/55/23223.html)
Bombs burst in air and the rocket red glare.......
Hope this keeps the pricks in charge of spying on the common man a bit of extra
work.

new topic     » topic index » view message » categorize

2. Re: Treeview Rant !

Thanks Derek either I dont understand your responce or
you misinterpreted mine.

25 is never a returned value in vKey = peek(lParam + 12)

If I hold down the shift + tab keys at the same time only
the tab key or '9' is returned.

I might need to use HKM_SETHOTKEY as a work around

Euman

----- Original Message ----- 
From: "Derek Parnell" <ddparnell at bigpond.com>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, April 24, 2002 1:59 AM
Subject: RE: Treeview Rant !


> 
> 
> euman at bellsouth.net wrote:
> > Hello all,
> > 
> > I found what I consider to be a bug in the Treeview control
> > 
> > consider this bit of code. ->
> > 
> > elsif iMsg = TVN_KEYDOWN then
> >        vKey = peek(lParam + 12) --struct tagTVKEYDOWN (WORD wVKey)
> >        if vKey = 9 then                                  
> >           SetFocus(futurecontrol) 
> >        elsif vKey = 25 then  -- should be shift+tab    
> >           SetFocus(previouscontrol)                             
> >        end if
> > end if
> > 
> > works really good but what if someone wanted to reverse the taborder 
> > direction
> > for focus purposes? 
> > 
> > shift+tab "or"  shift = 16 + tab = 9  should be vKey = 25
> > but this control doesnt handle this in the right way thus returning vKey 
> > = 9
> > 
> > you cant go backward from a Treeview control, unless someone can provide 
> > a
> > work around...
> > 
> 
> This one way you might like to try:
>  
>   if StandardTabbing then
>       ForwardTab = 9
>       BackwardTab = 25
>   else
>       ForwardTab = 25
>       BackwardTab = 9
>   end if
> 
>  . . . 
> 
>  elsif iMsg = TVN_KEYDOWN then
>         vKey = peek(lParam + 12) --struct tagTVKEYDOWN (WORD wVKey)
>         if vKey = ForwardTab then                                  
>            SetFocus(futurecontrol) 
>         elsif vKey = BackwardTab then  -- should be shift+tab    
>            SetFocus(previouscontrol)                             
>         end if
>  end if
> 
> -------------
> This hightlights the problems of too much hard-coding.
> 
> -----
> Derek.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Treeview Rant !

Bingo Derek,

LPNMTVKEYDOWN lpnmtvkd = reinterpret_cast<LPNMTVKEYDOWN>(lpNMHDR); 

if(lpnmtvkd->wVKey == VK_TAB) 
{ 
    bool bShiftDown = (GetKeyState(VK_SHIFT) < 0) ? true : false; 
    if(bShiftDown) 
        MessageBox(m_hWnd, "<SHIFT>+<TAB> was pressed", "Msg", MB_OK); 
} 

I got this reply from microsoft.public.win32.programmer.ui - newsgroup

Thanks,
Euman

----- Original Message ----- 
From: "Derek Parnell" <ddparnell at bigpond.com>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, April 24, 2002 5:19 PM
Subject: RE: Treeview Rant !


> 
> 
> euman at bellsouth.net wrote:
> > Thanks Derek either I dont understand your responce or
> > you misinterpreted mine.
> > 
> > 25 is never a returned value in vKey = peek(lParam + 12)
> > 
> > If I hold down the shift + tab keys at the same time only
> > the tab key or '9' is returned.
> > 
> > I might need to use HKM_SETHOTKEY as a work around
> > 
> 
> My fault. I guess I totally misunderstood your problem.
> 
> When you wrote "works really good" I assumed that the code example was 
> working to your satisfaction and that you were asking a hypothetical 
> question.
> 
> Anyhow, if the TreeView notifications don't give you the state of the 
> shift keys, you might have to consider calling either "GetAsyncKeyState" 
> or "GetKeyState" , or maybe even "GetLastInputInfo" to find out if the 
> shift key(s) are down or up.
> ----
> Derek.
> 
> > ----- Original Message ----- 
> > From: "Derek Parnell" <ddparnell at bigpond.com>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Wednesday, April 24, 2002 1:59 AM
> > Subject: RE: Treeview Rant !
> > 
> > 
> > > euman at bellsouth.net wrote:
> > > > Hello all,
> > > > 
> > > > I found what I consider to be a bug in the Treeview control
> > > > 
> > > > consider this bit of code. ->
> > > > 
> > > > elsif iMsg = TVN_KEYDOWN then
> > > >        vKey = peek(lParam + 12) --struct tagTVKEYDOWN (WORD wVKey)
> > > >        if vKey = 9 then                                  
> > > >           SetFocus(futurecontrol) 
> > > >        elsif vKey = 25 then  -- should be shift+tab    
> > > >           SetFocus(previouscontrol)                             
> > > >        end if
> > > > end if
> > > > 
> > > > works really good but what if someone wanted to reverse the taborder 
> > > > direction
> > > > for focus purposes? 
> > > > 
> > > > shift+tab "or"  shift = 16 + tab = 9  should be vKey = 25
> > > > but this control doesnt handle this in the right way thus returning vKey
> > > >
> > > > 
> > > > = 9
> > > > 
> > > > you cant go backward from a Treeview control, unless someone can provide
> > > >
> > > > 
> > > > a
> > > > work around...
> > > > 
> > > 
> > > This one way you might like to try:
> > >  
> > >   if StandardTabbing then
> > >       ForwardTab = 9
> > >       BackwardTab = 25
> > >   else
> > >       ForwardTab = 25
> > >       BackwardTab = 9
> > >   end if
> > > 
> > >  . . . 
> > > 
> > >  elsif iMsg = TVN_KEYDOWN then
> > >         vKey = peek(lParam + 12) --struct tagTVKEYDOWN (WORD wVKey)
> > >         if vKey = ForwardTab then                                  
> > >            SetFocus(futurecontrol) 
> > >         elsif vKey = BackwardTab then  -- should be shift+tab    
> > >            SetFocus(previouscontrol)                             
> > >         end if
> > >  end if
> > > 
> > > -------------
> > > This hightlights the problems of too much hard-coding.
> > > 
> > > -----
> > > Derek.
> > 
> > 
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu