×

Discussion Board

Results 1 to 4 of 4

Hybrid View

  1. #1
    Registered User
    Join Date
    Jun 2004
    Location
    Helsinki, Finland
    Posts
    38

    why do I get panic EIKON-EDWIN 8 when trying to use an AVKON_INTEGER_EDWIN control?

    Ok, so I've given up on the two-control dialog and gone with two separate dialogs. (See the post "frustrations in using dialogs and controls" (http://discussion.forum.nokia.com/fo...d.php?t=124421) I just posted on this same discussion board.)

    The first dialog is defined by the following resource:

    Code:
    RESOURCE DIALOG r_authorisation_extension_query_dialog
        {
        flags   = EGeneralQueryFlags; 
        buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
        items   =
            {
            DLG_LINE
                {
                type      = EAknCtQuery;
                id        = EAuthQueryDlgExtensionEntryId;
                itemflags = EAknEditorFlagNoT9;
                control   = AVKON_DATA_QUERY
                    {
                    layout = ENumberLayout;
                    // class CAknIntegerEdwin can be instantiated based on a
                    // AVKON_INTEGER_EDWIN control:
                    control = AVKON_INTEGER_EDWIN
                        {
                        min         = 0;
                        unset_value = 0;
                        maxlength   = KMaxExtensionDigits;
                        };
                    };
    
                }
            };
        }
    KMaxExtensionDigits is defined as 8 in the app's .hrh file.

    The following code is from the view container class that instantiates the dialog:

    Code:
    TBool CMobUiAuthorisationViewContainer::HandleAuthorisation()
        {
        HBufC* iExtensionDigits( NULL );
        HBufC* headerText = StringLoader::LoadLC( R_STRING_EXTENSION_PROMPT );
        iAuthQueryDlg = new ( ELeave ) CMobUiAuthorisationQueryDialog( *headerText,
                                                                       EFalse,
                                                                       iExtensionDigits );
        CleanupStack::PopAndDestroy( headerText );
    
        iAuthQueryDlg->SetMopParent( this );
        iAuthQueryDlg->ExecuteLD( R_AUTHORISATION_EXTENSION_QUERY_DIALOG );
        //!!! continue...
        }
    The resource R_STRING_EXTENSION_PROMPT contains the instruction to the user to enter an extension number, since the DLG_LINE's prompt field is useless (see my post "frustrations in using dialogs and controls" just posted before this one). The resource R_AUTHORISATION_EXTENSION_QUERY_DIALOG is the dialog resource whose definition I gave above. (The idea here is to use the same CMobUiAuthorisationQueryDialog class for entering both the extension number, and, later, the PIN, just instantiated with a different resource ID. But that's beside the point here.)

    When the line iAuthQueryDlg->ExecuteLD is executed, the dialog comes up on the emulator screen, showing the instruction text and an edit box (= the control). I can enter digits into the edit box, and after the eighth one, no more are accepted, because of the maxlength definition in the dialog resource, as expected. When I press the OK softkey, the program execution moves to the following function:

    Code:
    TBool CMobUiAuthorisationQueryDialog::OkToExitL( TInt aKeycode )
        {
        switch ( aKeycode )
            {
            case EAknSoftkeyOk:
                {
                if ( !iExtensionOrPin ) // I'm reusing the same code for the PIN dialog.
                                        // EFalse here just means we're executing the
                                        // dialog for entering an extension number.
                    {
                    // We're getting the extension number.  Get the editor control:
                    CAknIntegerEdwin* extensionEditor =
                        static_cast< CAknIntegerEdwin* >(
                            ControlOrNull( EAuthQueryDlgExtensionEntryId ) );
                    if ( extensionEditor == NULL )
                        {
                        // something is very wrong if the control can't be accessed
                        User::Leave( EMobilityUi );
                        }
                    TInt enteredExtension;
    
    /* CRASH HERE: */
                    CAknNumericEdwin::TValidationStatus validationStatus =
                        extensionEditor->GetTextAsInteger( enteredExtension );
    
                    if (   ( validationStatus != CAknNumericEdwin::EValueValid )
                        || ( enteredExtension == 0 ) )
                        {
                        // Can't exit the dialog if nothing was entered, or if an
                        // invalid set of digits were entered.
                        return EFalse;
                        }
                    // discard any previous content of iEnteredDigits:
                    delete iEnteredDigits;
                    iEnteredDigits = NULL;
                    iEnteredDigits = HBufC16::NewLC( 0 );
                    // convert the read integer to a string, while assigning the
                    // result to the descriptor object owned by the caller:
                    iEnteredDigits->Des().Format( KSingleIntegerFormatString,
                                                  enteredExtension );
                    }
                else
                    {
                    // We're getting the PIN.  Get the editor control:
                    CAknNumericSecretEditor* passwordEditor =
                        static_cast< CAknNumericSecretEditor* >(
                            Control( EAuthQueryDlgPasswordEntryId ) );
                    //!! continue....
                    }
    
                return ETrue; // yes, dialog can exit if softkey OK pressed
                }
            case EAknSoftkeyCancel:
                {
                return ETrue; // yes, dialog can exit if softkey Cancel pressed
                }
            default:
                {
                return EFalse; // no, dialog can't exit otherwise
                }
            }
        }
    Everything goes fine until the line I've marked with /* CRASH HERE: */. The function call ControlOrNull gives me a non-null pointer, which I presume is to the control identified by EAuthQueryDlgExtensionEntryId, which was used in the resource definition to identify the dialog line.

    What happens is that on the emulator screen, the error App. closed: Application Name EIKON-EDWIN 8 is displayed. EIKON-EDWIN 8 is apparently the ninth code (first one is 0) in enum TEikEdwinPanic in file epoc32\include\eikedwin.pan, namely EEikPanicEdwinNoText.

    This is strange, as I most definitely did enter text into the control, and even if I hadn't, that should not be communicated by a panic, but rather by a value of EEmpty (of type CAknNumericEdwin::TValidationStatus) returned by the function GetTextAsInteger.

    I googled for other mentions of people getting a panic of type EIKON-EDWIN 8, but found nothing useful. Someone mentioned that when an EDWIN control has been defined with a flag EEikEdwinUserSuppliedText, this problem might occur, but (a) this is an AVKON_INTEGER_EDWIN control, and (b) the flag I used was EGeneralQueryFlags, which is defined as EAknDialogGenericQueryFlags in avkon.hrh, which is defined as (EEikDialogFlagWait | EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | EEikDialogFlagCbaButtons) in the same file; i.e., no EEikEdwinUserSuppliedText.

    I thought that I was doing something wrong with the AVKON_INTEGER_EDWIN control, so tried, instead, an EDWIN control, and changed the code accordingly. Instead of calling extensionEditor->GetTextAsInteger, which is not available for the CEikEdwin class that goes with an EDWIN control, I called extensionEditor->GetTextInHBufL, which should simply return an HBufC* containing the entered text. Instead, when I tried to step over that line in the debugger, I got, again, a panic of type EIKON-EDWIN 8.

    So, I'm stumped. What the hell am I doing wrong now? What undocumented or underdocumented little programming detail or details have I overlooked now? Please, anybody?!?
    Last edited by leisti; 2008-01-10 at 03:23.

  2. #2
    Registered User
    Join Date
    Jun 2004
    Location
    Helsinki, Finland
    Posts
    38

    Re: why do I get panic EIKON-EDWIN 8 when trying to use an AVKON_INTEGER_EDWIN contro

    Update: googling for the problem reveals that others have experienced this problem. Nickname "wowman" was trying to do the very same thing I was, and writes at http://discussion.forum.nokia.com/fo...d.php?t=72150:

    I'm trying to retrieve an integer value from a DLG_LINE on a S60 device. Below is a sample from my *.rss file that defines a part of the interface.

    Code:
    DLG_LINE
        {
        type = EAknCtQuery;
        id = EGeneralAmountQuery;
        control = AVKON_DATA_QUERY
            {
            layout = ENumberLayout;
            label = "Amount (£):";
            control = AVKON_INTEGER_EDWIN
                {
                min = 1;
                max = 10;
                unset_value=0;
                };
            };
        }
    I use the following code to obtain a reference to the editor, and then call GetTextAsInteger(Tint x) to retrieve the value entered by the user.

    Code:
    CAknIntegerEdwin* amountEditor = static_cast<CAknIntegerEdwin*>(ControlOrNull(EGeneralAmountQuery));
    
    if (amountEditor)
    {
        CAknNumericEdwin::TValidationStatus amountStatus = amountEditor->GetTextAsInteger(tmpAmount);
    }
    The above code causes a runtime error. I found that this is caused by the nested control struct in the DLG_LINE. If I remove the outer control struct (and therefore also the label and layout fields of that struct) the code works fine and the values can be retrieved.

    All books and online examples seem to have an outer control struct of type AVKON_DATA_QUERY with an inner control struct of type AVKON_INTEGER_EDWIN (for example), but nowhere can I find the code to retrieve the values entered by the user.

    Summary: Does anyone have any code or can offer any help in retrieving values from an interface defined by the rss code at the top of this post.
    No one answered him. (I wonder why do all the code examples and books give a nested control structure, if that does not work?)

    It does make sense that the line id = EGeneralAmountQuery refers to the control that immediately follows, that is, the AVKON_DATA_QUERY, rather than the AVKON_INTEGER_EDWIN control nested inside that one, which the C++ code is trying to access.

    However, when I tried to do what he advised, namely removing the outer AVKON_DATA_QUERY control (and the fields "layout" and "label", of course), the resource compiles, but when I run the application, it crashes right away with a BAFL 4 panic. So I wonder how exactly he did get his resource to work.

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    50

    Re: why do I get panic EIKON-EDWIN 8 when trying to use an AVKON_INTEGER_EDWIN contro

    The solution is:
    - get the control which is AknCtControl and
    - get the layout which is edwin

    CAknQueryControl* control = static_cast<CAknQueryControl*>(ControlOrNull(EGeneralQuery));
    CEikEdwin* nameEdwin = static_cast<CEikEdwin*> ( control->ControlByLayoutOrNull( EDataLayout ) );


    http://discussion.forum.nokia.com/fo...d.php?t=127534

    cheers
    Naveen

  4. #4
    Registered User
    Join Date
    Mar 2003
    Location
    Luttenberg (Netherlands)
    Posts
    577

    Thumbs up Re: why do I get panic EIKON-EDWIN 8 when trying to use an AVKON_INTEGER_EDWIN contro

    Hint:

    use

    CAknQueryControl* control = QueryControl();

    instead of

    CAknQueryControl* control =
    static_cast<CAknQueryControl*>(ControlOrNull(EGeneralQuery));

    Both methods work, but the first one reads a little bit easier :). Very good answer! Compliment to pncbose! Thanks for helping me to find my solution.

    BR,

    Rene
    Rene Heuven
    Inmote - Creative Smartphone Solutions
    Web: www.inmote.com
    E-mail: rene@inmote.com

Similar Threads

  1. Using Bluetooth serial port in MIDlets (nokia 9500 issue)
    By orsteglasy in forum Mobile Java Networking & Messaging & Security
    Replies: 11
    Last Post: 2007-10-07, 21:49
  2. Edwin control problem
    By msulaiman in forum Symbian
    Replies: 2
    Last Post: 2007-09-16, 14:30
  3. Edwin control in navigation pane
    By symbee in forum Symbian User Interface
    Replies: 1
    Last Post: 2006-07-07, 11:18
  4. Edwin control query
    By SymbieRahul in forum Symbian User Interface
    Replies: 1
    Last Post: 2006-05-23, 03:50
  5. edwin control is not getting into editable mode
    By shilpav in forum Symbian User Interface
    Replies: 1
    Last Post: 2005-01-13, 23:43

Posting Permissions

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