×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    60

    How to use TUid from Class XY1 in Class XY2?

    Hi, im new to programming and need some help.

    i have a function FocusChangeEventL() which is part of the class CGalleryFXAppUi.
    In FocusChangeEventL() i get the UID of a Foreground process: TUid uid=...

    Now i want to use this uid in the function HandlePointerEventL(const TPointerEvent& aEvent)
    which is part of the class CContainerButton.

    How can i do this?? i just cant get it.



    Code:
    class CGalleryFXAppUi : public CAknViewAppUi, public MFgrCallBack
    	{
    public: 
        .....
    	void FocusChangeEventL();
    
    ---------------------------------------------------------------------------------------------------	
    
    void CGalleryFXAppUi::FocusChangeEventL()
    	{
    	CApaWindowGroupName* wg=CApaWindowGroupName::NewL(*iWsSession,iWsSession->GetFocusWindowGroup());
    	TUid uid=wg->AppUid();
    	....
    	
    ---------------------------------------------------------------------------------------------------		
    	
    	
    class CContainerButton: public CCoeControl
    	{
    public:
    	.....
    	void HandlePointerEventL(const TPointerEvent& aEvent);	
    	
    ---------------------------------------------------------------------------------------------------		
    
    void CContainerButton::HandlePointerEventL(const TPointerEvent& aEvent)
    	{	
    	TRawEvent ev;
    	if (uid == ... )
    	    .....

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: How to use TUid from Class XY1 in Class XY2?

    You can declare that TUid type as global instead of taking it as local. Declare TUid type in Appui's header & use it everywhere by creating an object of AppUi in other class.

    void CContainerButton::ConstructL()
    {
    ...
    iAppUi = (CGalleryFXAppUi *) (CEikonEnv::Static()->AppUi()); // CGalleryFXAppUi *iAppUi ; in header

    ...
    }

    void CContainerButton::HandlePointerEventL(const TPointerEvent& aEvent)
    {
    if (iAppUi->uid == ... )
    .....
    }

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    60

    Re: How to use TUid from Class XY1 in Class XY2?

    thanks for reply, heres what i did, but i get some errors:

    Declare TUid type in Appui's header
    how would this look like? and in which class? sorry for my dumb questions.. im kind of confused atm??



    appui h:--------------------------------------------------------------------------------

    class CGalleryFXAppUi : public CAknViewAppUi, public MFgrCallBack
    {
    public:
    .....
    TUid uid;
    }
    --------------------------------------------------------------------------------

    class CContainerButton: public CCoeControl
    {
    public:
    ....
    CGalleryFXAppUi *iAppUi;
    }


    appui cpp:--------------------------------------------------------------------------------

    void CContainerButton::ConstructL(RWindowGroup* aWg)
    {
    .....
    iAppUi=(CGalleryFXAppUi *)(CEikonEnv::Static()->AppUi());
    }

    --------------------------------------------------------------------------------

    void CContainerButton::HandlePointerEventL(const TPointerEvent& aEvent)
    {
    if (iAppUi->uid == ...)
    ....
    }

    --------------------------------------------------------------------------------

    void CGalleryFXAppUi::FocusChangeEventL()
    {
    CApaWindowGroupName* g=CApaWindowGroupName::NewL(*iWsSession,iWsSession->GetFocusWindowGroup());
    TUid uid=wg->AppUid();

    }

  4. #4
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: How to use TUid from Class XY1 in Class XY2?

    And the error message is?
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

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

    Re: How to use TUid from Class XY1 in Class XY2?

    TUid uid=wg->AppUid(); , uid is declared in AppUi already, so simply write :

    uid = wg->AppUid(); & use this in container.

  6. #6
    Registered User
    Join Date
    Mar 2012
    Posts
    60

    Re: How to use TUid from Class XY1 in Class XY2?

    hmm, perhaps its too late, i just dont get it...

    And the error message is?
    -undefined identifier 'CGalleryFXAppUi'
    -undefined identifier 'iAppUi'
    -undefined identifier 'uid'



    void CContainerButton::HandlePointerEventL(const TPointerEvent& aEvent)
    {
    uid = wg->AppUid();
    if ( uid == ...)
    ....
    }

  7. #7
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: How to use TUid from Class XY1 in Class XY2?

    Well if you are using any class (AppUi in this case) somewhere then you also need to include its header etc in the class where it is used.

  8. #8
    Registered User
    Join Date
    Mar 2012
    Posts
    60

    Re: How to use TUid from Class XY1 in Class XY2?

    I tried several things now, but its just not working...

    Are there any examples containig a declaration of a Tuid or similar in different classes??
    Or could anybody just edit my example below? Thanks.


    myappui.h
    class CMyAppUi :
    public:
    ???

    class CContainerButton:
    public:
    ???

    myappui.cpp
    void CMyAppUi::function1()
    {
    TUid uid=wg->AppUid();
    }

    void CContainerButton::ConstructL(...)
    {
    ???
    }

    void CContainerButton::function2()
    {
    if (uid==...)
    }
    Last edited by shizzl; 2012-05-14 at 16:32.

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: How to use TUid from Class XY1 in Class XY2?

    There is no Symbian C++ without C/C++. Search for c c++ declaration definition and read a little.
    You probably need a simple
    Code:
    #include "GalleryFxAppUi.h"
    in order to eliminate the errors listed in #6.

    For the edit: you need this line in the .cpp file where CContainerButton::function2 resides.

  10. #10
    Registered User
    Join Date
    Mar 2012
    Posts
    60

    Re: How to use TUid from Class XY1 in Class XY2?

    i know the problem now:


    Code:
    class CContainerButton: public CCoeControl
    	{
    public:
    	...
    	CGalleryFXAppUi *iAppUi;
    	};
    
    class CGalleryFXAppUi : public CAknViewAppUi, public MFgrCallBack
    	{
    public: 
    	....
    i get this error: ISO C++ forbids declaration of 'CGalleryFXAppUi' with no type


    when i put a class CGalleryFXAppUi; at the top


    Code:
    class CGalleryFXAppUi;
    
    class CContainerButton: public CCoeControl
    	{
    public:
    	...
    	CGalleryFXAppUi *iAppUi;
    	};
    
    class CGalleryFXAppUi : public CAknViewAppUi, public MFgrCallBack
    	{
    public: 
    	....
    i get no error, but uid got no value??

Similar Threads

  1. Replies: 9
    Last Post: 2009-01-06, 13:22
  2. Replies: 6
    Last Post: 2007-03-14, 12:56
  3. Replies: 0
    Last Post: 2004-03-03, 10:34
  4. How to convert 'class TBuf8<60>' to 'const class TDesC16 &'
    By wingfancy in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-05-08, 12:58

Posting Permissions

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