×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    41

    Question How to create a floating window and detect touch event

    I created a floating window with this code, but i don't know how to detect when user touches it, or to get pointer position on this window when user touches it.

    Code:
       User::LeaveIfError(ws.Connect());
        screen = new(ELeave) CWsScreenDevice(ws);
        screen->Construct();
     
        RWindowGroup wg(ws);
        User::LeaveIfError(wg.Construct(reinterpret_cast<TUint32>(&wg), EFalse));
        CleanupClosePushL(wg);
     
        wg.SetOrdinalPosition(10, ECoeWinPriorityAlwaysAtFront);
     
        CWindowGc* gc;
        User::LeaveIfError(screen->CreateContext(gc));
        CleanupStack::PushL(gc);
     
        RWindow window(ws);
        User::LeaveIfError(window.Construct(wg, reinterpret_cast<TUint32>(&wg) + 1));
        CleanupClosePushL(window);
        window.SetBackgroundColor(TRgb(0x90, 0x90, 0x90));
        window.Activate();
        window.SetExtent(TPoint(0, 0), TSize(50, 300));
        window.SetVisible(ETrue);
        
        gc->Activate(window);
     
     
        TRect rect = TRect(window.Size());
        window.Invalidate(rect);
        window.BeginRedraw(rect);
     
        gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
        gc->Clear();
    
    
        gc->SetBrushColor(TRgb(0, 255, 0));
        gc->DrawRect(rect);
       
     
        window.EndRedraw();
        gc->Deactivate();
     
        ws.Flush();

    thanks.

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    India
    Posts
    1,174

    Re: How to create a floating window and detect touch event

    You should check HandlePointerEventL()... it will let you know of the touch events.

  3. #3
    Registered User
    Join Date
    Feb 2012
    Posts
    41

    Re: How to create a floating window and detect touch event

    But how could I bind iWindow with HandlePointerEventL() ??

    Is there a function under RWindow I can pass it a callback object to receive pointer event??

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to create a floating window and detect touch event

    Yep, she basically though that you are using normal application framework. anyway, you should first make a real class instance for handling the screen and derive it from CActive, a bit like this: http://www.developer.nokia.com/Commu...tion_framework

    then you could use the RWsSession's EventReady (instead of the example RedrawReady) to catch all events, also do remember to enable focus for your window.

  5. #5
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,089

    Re: How to create a floating window and detect touch event

    Also look at the following method : RWindow::SetPointerCapture()

  6. #6
    Registered User
    Join Date
    Feb 2012
    Posts
    41

    Re: How to create a floating window and detect touch event

    hi guys, and girls,

    I managed to get my code work , and i can detect when user touches the window, and the (x,y) point.

    My problem is, how to detect when user touches the screen out of my floating window, so I can dismiss it?

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to create a floating window and detect touch event

    if you plan to disable the screen, you should make transparent window that fills the whole screen.

  8. #8
    Registered User
    Join Date
    Feb 2012
    Posts
    41

    Re: How to create a floating window and detect touch event

    No, I'm not planning to disable the whole screen, i just want to show my floating window ( it will be as a task bar, in screen corner ), and if user clicks it, it will launch an application and disappear, and if user click out / away from my window, it will just disappear.

  9. #9
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to create a floating window and detect touch event

    So in that case you could also use the method I descriped, then of cource the touch event used for the dismissing would be lost, unless you find a way to forward it.

  10. #10
    Registered User
    Join Date
    Jul 2012
    Posts
    20

    Re: How to create a floating window and detect touch event

    How did you get it working, could you please share some of the code with me(us) as I am trying to make something similar.

  11. #11
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to create a floating window and detect touch event

    You could maybe just try out the code in the link, and then describe what the problem you still have is.

Similar Threads

  1. Doubt about top level window touch event on 5th and ^3
    By ixustar in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2011-11-03, 08:22
  2. Detect touch event on idle screen..
    By amol_benare604 in forum Symbian
    Replies: 11
    Last Post: 2010-06-16, 09:28
  3. Reg: Transparent Floating Window.
    By gabbar007 in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-09-04, 06:23
  4. Floating Window problem
    By lauyk001 in forum Symbian
    Replies: 2
    Last Post: 2004-11-29, 05:08
  5. showing floating point value in editor window
    By tuomap in forum Symbian User Interface
    Replies: 0
    Last Post: 2002-10-30, 07:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×