×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Simple text input field

    I'm trying to create a text editor (CEikEdwin) in AppUi class like this:

    iMsgEditor = new (ELeave) CEikEdwin;
    iMsgEditor->ConstructL(CEikEdwin::EJustAutoCurEnd, 0, 0, 100);
    iMsgEditor->SetContainerWindowL(*this);

    I expected the editor to draw itself, but I cannot see it. I tryed to call iMsgEditor->SetFocus(ETrue), but nothing happend. I also tryed to call ActivateL() on the AppUi class but that crashes the application (seems to be a panic).
    It feels like I'm missing the point here. What am I supposed to do to get a simple text input field? Preferably I would like to not create from a resource.
    Can anyone show me a very, very simple example?

  2. #2
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: Simple text input field

    Quote Originally Posted by erst
    I'm trying to create a text editor (CEikEdwin) in AppUi class like this:

    iMsgEditor = new (ELeave) CEikEdwin;
    iMsgEditor->ConstructL(CEikEdwin::EJustAutoCurEnd, 0, 0, 100);
    iMsgEditor->SetContainerWindowL(*this);

    I expected the editor to draw itself, but I cannot see it. I tryed to call iMsgEditor->SetFocus(ETrue), but nothing happend. I also tryed to call ActivateL() on the AppUi class but that crashes the application (seems to be a panic).
    It feels like I'm missing the point here. What am I supposed to do to get a simple text input field? Preferably I would like to not create from a resource.
    Can anyone show me a very, very simple example?
    Hi,
    first u make a view or container then after U implement any component or editor in ur application..

    U can check /see editor example in SDK

  3. #3
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: Simple text input field

    Ok, I add the same piece of code to my AppView's ConstructL(), no difference.

    I been looking at the RichTextEditor example and the Editor Example in the API documentation. Why do I need a container? Do I really need to create extra classes to display a very simple editable text field?

    Would be great if someone could show an example using minimal amount of code, just how to get the simpliest text editor running.

    Thanks!

  4. #4
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: Simple text input field

    Quote Originally Posted by erst
    someone could show an example using minimal amount of code, just how to get the simpliest text editor running.
    Ok,

    U give me ur email id I'll send a simple example code........

    Good day!

  5. #5
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Simple text input field

    Well yes you require a container to add any components.

    But there are way arounds,
    what is the purpose of this msgeditor?

    if you want to query something or take some user input, there are local or global query dialogs which are simple to use.
    These could be used for example:

    Local :

    Confirmation Query Dialog : CAknQueryDialog
    Data Query Dialogs: CAknTextQueryDialog
    you also list queries....


    Global :

    CAknGlobalConfirmationQuery
    CAknGlobalListQuery
    CAknGlobalMsgQuery


    if you tell why u need the msgeditor, then probably we can suggest what should be done
    hope these helps you....
    Amit Kankani
    Nokia Developer Champion

  6. #6
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: Simple text input field

    Quote Originally Posted by amitkankani
    what is the purpose of this msgeditor?

    Confirmation Query Dialog : CAknQueryDialog
    Data Query Dialogs: CAknTextQueryDialog
    you also list queries....
    Hi amit, Suppose he want insert or display 100 lines or 1000 character can it be possible in Confirmation Query Dialog : CAknQueryDialog
    Data Query Dialogs: CAknTextQueryDialog .. without editor...

  7. #7
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Simple text input field

    not sure about the limit with the dialogs.... !!!

    may be he can try and see... and let me know too
    Amit Kankani
    Nokia Developer Champion

  8. #8
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: Simple text input field

    Sorry, bad code example. What I want to is something like this:

    iMsgEditor->ConstructL(CEikEdwin::EOnlyASCIIChars, 50, 0, 1);

    Just a simple field where user can type text. In j2me it is as simple as this:
    Form form = new Form("Login");
    TextField loginField = new TextField("Username", "", 50, TextField.ANY);
    form.append(loginField);

    I don't mean to compare j2me to Symbian C++, of course C++ is always much more low level. But the java API is much more intiutive. Took me few minutes to figure out what to do, here I been looking at examples and documentation, and most of the time I tryed to understand why it should be so complicated.

    That's why I want an example that is as simple as possible. My email is: erst @ coolmail.se

    Thanks for helping me out!

  9. #9
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Simple text input field

    well it looks like you want appx only 50 chars input,
    then see for CAknTextQueryDialog in the sdk document and it is simple

    may be not as simple as java though
    Amit Kankani
    Nokia Developer Champion

  10. #10
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: Simple text input field

    Thanks Amit! Just what I was looking for! Now I also found it in the pdf I been looking in. Amazing what you can find when you know what to look for.

    To be able to use CAknTextQueryDialog I find no other way then using a resource. I added the resource in my .rss file, I include the .rsg (same name as the .rss I suppose) and it compiles fine. But when I start the applicatonon the phone I get a "System Error" alert as soon as I start it.

    I have no good knowledge in how it links the files, I realised that I need to include the .rsg file (that I think is generated) to access the resources in the .rss file. I'm including the .rsg file in my AppView class.

    What is wrong?

  11. #11
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Simple text input field

    A system error could be many things like:
    1. Icon not proper
    2. mbm files not placed in the right folder
    3. resource files not placed in the right folder.
    4. and , it could also be due to corrupt compilation, in which case you have to clean the project and try again.
    5. Not sure, could be something else too...

    best wud be... put ur pkg file here and also state which sdk ? we will try to help
    Amit Kankani
    Nokia Developer Champion

  12. #12
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: Simple text input field

    It did work before I put: #include "Hello.rsg" in HelloAppUI.cpp

    If I don't include the .rsg file it says that resource is undefined. If I comment out the code using the resource and recompile, everything works like before.

  13. #13
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: Simple text input field

    I was wrong, what actually causes the error is the resource code I add in the .rss file. I add this at the top of my .rrs file:

    RESOURCE DIALOG r_demo_data_query
    {
    flags = EGeneralQueryFlags;
    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
    items =
    {
    DLG_LINE
    {
    type = EAknCtQuery;
    id = EGeneralQuery;
    control = AVKON_DATA_QUERY
    {
    layout = EDataLayout;
    label = ""; // prompt text
    control = EDWIN
    {
    width = 5;
    lines = 1;
    maxlength = 15;
    };
    };
    }
    };
    }

    ...copied from the pdf mentioned before. I'm using 3rd edition mr sdk with carbide c++ express. What might be wrong with this resource?

  14. #14
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Simple text input field

    well not sure but u can try putting the resource definition towards the end of the file....

    also the code would be something like this:



    // The descriptor used for the editor

    TBuf<128> text;

    // The descriptor contained the prompt text for the query. The prompt // text can also be defined in the resource structure of the query

    TBuf<128> prompt(_L("Enter data:"));

    // create dialog instance

    CAknTextQueryDialog* dlg =

    new( ELeave ) CAknTextQueryDialog( text, prompt );

    // Prepares the dialog, constructing it from the specified resource

    dlg->PrepareLC( R_DEMO_DATA_QUERY );

    // Sets the maximum length of the text editor

    dlg->SetMaxLength(10);

    // Launch the dialog

    if (dlg->RunLD())

    {

    // ok pressed, text is the descriptor containing the entered text // in the editor.

    }
    Amit Kankani
    Nokia Developer Champion

  15. #15
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: Simple text input field

    It works! Don't know why, but the problem disappear when I put the resource last in the .rss file. Thanks!

    Another question; the "C" in PrepareLC() indicates that it put something on the cleanup stack. Then RunLD() deletes an object from the heap, in this case it must be the CAknTextQueryDialog object. What happens to the object put on the cleanup stack?

Page 1 of 2 12 LastLast

Similar Threads

  1. Getting text from active text field
    By inguvaseshu in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-07-06, 12:02
  2. Replies: 2
    Last Post: 2006-01-31, 11:46
  3. Replies: 0
    Last Post: 2004-11-24, 18:49
  4. Input in text field without new window
    By raffaelesergi in forum Mobile Java General
    Replies: 3
    Last Post: 2003-10-28, 10:58
  5. pls help! sample code for a simple dialog with text input for 9210
    By edmundkkchan in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-06-21, 17:23

Posting Permissions

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