paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [paragui-users] 2 listbox and keyboard


From: Ulf Lorenz
Subject: Re: [paragui-users] 2 listbox and keyboard
Date: Fri, 9 Dec 2005 17:30:48 +0100
User-agent: Mutt/1.5.11

On Thu, Dec 08, 2005 at 06:17:48PM +0200, ??????? wrote:
> please, help me how to do the following:
> use buttons UP and DOWN to scroll throgh listbox_1, and in such a way,
> that any actions will be executed, while changing the current position
> in listbox_1. And to use buttons LEFT and RIGHT to scroll through
> listbox_2.  And to execute any action with ENTER button. there is no
> mouse in the system.  If it is possible, give the example of the code.
Just a sketch:


BigWidget : public PG_Widget
{
    ....
    private:
        bool eventKeyDown(SDL_KeyboardEvent* key);
    ....
        PG_ListBox *listbox1, *listbox2;
}


bool BigWidget::eventKeyDown(SDL_KeyboardEvent* key)
{
    switch (key->keysym.sym)
    {
        case SDLK_DOWN:
            listbox1->SelectNextItem();
            fillListBox2();
            break;
        case SDLK_LEFT:
            listbox2->SelectPrevItem();
            break;
        case SDLK_RETURN:
            executeAction();
            break;
        ....
    }

    return true;
}


This should work. If nothing happens because the BigWidget doesn't get
the events, set a capture hook (see pgmessageobject.h). Then it gets ALL
events that are generated.

Any open questions?


cu,
Ulf

-- 
recursive:
            see recursive




reply via email to

[Prev in Thread] Current Thread [Next in Thread]