×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    235

    Passing a TDesC between views

    Hi,

    I've been reading through the forum but haven't found anything that i could use.

    I would like to know how to pass the value in a TDesC variable from one View's Container to another View's Container into another?

    If i try to store a TDesC& variable in the View the error says it must be initialised in the constructor of that view.
    If i try to store a TDesC variable it says cannot access protected member.

    Also, how can I access the View1::Function() from View2->Container?

    Any help on these questions is appreciated,
    Thanks,
    ViruDoshi
    Last edited by ViruDoshi; 2005-12-19 at 18:16.
    ~ No Style Without Substance ~

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

    Re: Passing a TDesC between views

    TDes classes should not be instantiated, they are basically just abstract base classes, so just use them as a arguments in your functions, and with all variables use the derived classes (like TBuf) instead.

    yucca

  3. #3
    Regular Contributor
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    235

    Re: Passing a TDesC between views

    Hi,

    Thanks for the reply. You're absolutely correct, i did some reading and i'm trying to get to grips with descriptors, they're a little tricky.

    Maybe you can answer this for me; Why is it that if, for example, i define TBufC<100> text locally and then do text. (the full-stop) i get a intellisense context menu for that class but if i put TBufC<100> text2 in my header file then i try to use text2 in a function no intellisense context menu popsup?

    Thanks,
    ViruDoshi
    ~ No Style Without Substance ~

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

    Re: Passing a TDesC between views

    by "intellisense context", do you meant the selection pop-up that pops-up while typing with metrowerks ? I really dont know about that, I think that it has completely its own mind, most often I don't get it, when I would like, and definetely get it when I wouldn't really like to see it.

    yucca

  5. #5
    Regular Contributor
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    235

    Re: Passing a TDesC between views

    Nope not in CodeWarrior IDE, with Visual Studio.Net. Wonder if that new carbide.vs ide (when its released) will handle this better, not a big deal but makes me second guess myself sometimes when i expected it to show but it doesnt. Inadvertently, perhaps this'll make me a better programmer lol

    ViruDoshi
    ~ No Style Without Substance ~

  6. #6
    Registered User
    Join Date
    Oct 2005
    Posts
    40

    Re: Passing a TDesC between views

    Hi,

    Just in case you have not solved that one.

    What you can do it pass a TPtr to both view and once you have something in one view to pass to the other you can make that TPtr point to a TBuf or other.

    Once this is done you can always activate the other view so it can do something with the data you have passed.

    This is just a basic idea. I am not sure I understand why you want to do that.

    Usually a better way to do things is to keep the data in a place, only allow the UI to perform actions on the data and provide read only links to the data to views so they can render the data to the user.

    GreG

  7. #7
    Regular Contributor
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    235

    Re: Passing a TDesC between views

    Hi, thanks for the reply GreG.

    I've solved this now. My motive was that in one view i have a list of messages, when a item on the list is selected i get the Message that relates to that item's index, then i need to deactive this ListView and activate the MessageView which displays in an editor the message that was selected.

    So what i did was to save the message in a TBuf in the AppUi which the ListView accesses to Store the message text, and which the MessageView accesses to get the message text to show in the editor.

    Very similar to what you suggested.

    Thanks,
    ViruDoshi
    ~ No Style Without Substance ~

Similar Threads

  1. Returning a TDesC ?
    By lmussier in forum Symbian
    Replies: 2
    Last Post: 2005-11-10, 20:09
  2. Passing data between two views
    By vcribe in forum Symbian User Interface
    Replies: 3
    Last Post: 2005-01-31, 06:07
  3. got stuck with views
    By gsmartphone in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-01-06, 14:15
  4. Passing Data to Views
    By fcobsb in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-12-12, 20:10
  5. Switching views on a Dialog-based Views App
    By net314 in forum Symbian User Interface
    Replies: 4
    Last Post: 2003-08-26, 21:05

Posting Permissions

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