Your Win32API expertise, please

48 views
Skip to first unread message

Guy1954

unread,
May 21, 2012, 8:40:01 AM5/21/12
to xbl...@googlegroups.com
Hi Xbliter,

I can't solve a (minor) problem in viXen as hard as I try.
I can't get right the keyboard navigation within the navigation tree #tvwNav (control Id: $$tvwNav).

        The bug is:

I can use arrow up or arrow down just after I clicked on a treeview item to make it the current item,
but only the first time and not like I'd expect it: the selected item is not hilighted.

The second time is even worse,
-  the treeview loses the focus
- the Style listbox gets and keeps the focus and (very wrongly) processes subsequent arrows up or down.


        In vxbl.x, $$WM_KEYDOWN messages are processed as follows:

1. I subclass the navigation tree
SetWindowLongA (#tvwNav, $$GWL_WNDPROC, &tvwNav_Proc ())

2.   I handle $$WM_KEYDOWN/$$VK_DOWN, $$VK_UP

In FUNCTION tvwNav_Proc():
(...)
    SELECT CASE wMsg
        CASE $$WM_KEYDOWN    ' works with virtual key code (wParam)

            treehSel = SendMessageA (#tvwNav, $$TVM_GETNEXTITEM, $$TVGN_CARET, 0) ' get #tvwNav current selection
            IF treehSel THEN    ' selection
                SELECT CASE wParam    ' virtual key code
                    CASE $$VK_DOWN, $$VK_UP
                        IF wParam    = $$VK_DOWN THEN flag = $$TVGN_NEXT ELSE flag = $$TVGN_PREVIOUS
                        hItem = SendMessageA (#tvwNav, $$TVM_GETNEXTITEM, flag, treehSel)
                        #tvwNav_bSkipOnSelect = $$FALSE
                        SendMessageA (#tvwNav, $$TVM_SELECTITEM, $$TVGN_CARET, hItem)
                        RETURN
(...)


I thought it would trigger

In FUNCTION OnNotify (hWnd, wParam, lParam)
(...)
    SELECT CASE nmhdr.idFrom
        CASE $$tvwNav
            SELECT CASE nmhdr.code

                CASE $$TVN_SELCHANGED
                    pNmtv = &nmtv        ' tree view structure
                    XLONGAT (&&nmtv) = lParam
                    IFF #tvwNav_bSkipOnSelect THEN retCode = tvwNav_ItemClick (nmtv.itemNew.hItem)
                    XLONGAT (&&nmtv) = pNmtv
(...)

BUT it does not.!

If you think that you can give a shot at implementing the arrow key navigation within the navigation treeview,
you can download vixen_sources_v1_99u.zip at
http://sourceforge.net/projects/visual-xblite/files/vixen%20version%201/VIXEN%20v1.99/vixen_sources_v1_99u.zip/download

Thanks in advance.
Guy

Guy1954

unread,
May 22, 2012, 12:03:00 PM5/22/12
to xbl...@googlegroups.com
Hi Vixeners,

Was really nothing to get it right: I just set the focus on my navigation treeview.
Now, up and down keys work. Neaaaat!!!!!!!!!!!!!!!!!!!

Bye! Guy
Reply all
Reply to author
Forward
0 new messages