Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User SymNewbi's Avatar
    Join Date
    Feb 2012
    Posts
    41
    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 pooja_1650's Avatar
    Join Date
    Nov 2011
    Location
    India
    Posts
    310
    You should check HandlePointerEventL()... it will let you know of the touch events.

  3. #3
    Registered User SymNewbi's Avatar
    Join Date
    Feb 2012
    Posts
    41
    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 Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    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 vineet.jain's Avatar
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,841
    Also look at the following method : RWindow::SetPointerCapture()

  6. #6
    Registered User SymNewbi's Avatar
    Join Date
    Feb 2012
    Posts
    41
    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 Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    if you plan to disable the screen, you should make transparent window that fills the whole screen.

  8. #8
    Registered User SymNewbi's Avatar
    Join Date
    Feb 2012
    Posts
    41
    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 Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    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 Gerhman.dc's Avatar
    Join Date
    Jul 2012
    Posts
    20
    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 Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,672
    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 C++
    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 C++
    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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved