Home Bugs in S60 Dialogs
Post
Cancel

Bugs in S60 Dialogs

I found this when trying to get AntSnes remembering the last used directory. It was actually really simple and everything worked according to S60 documentation with N96, but N95-2 had some SW bugs on dialogs.

1
selected = AknCommonDialogs::RunSelectDlgLD(ptr,_L(E:\\SnesRoms\\),R_MEMORY_SELECTION_DIALOG, R_LOAD_ROM_DIALOG);

In N95-2 the code goes to the E root, like it wouldn’t find any roms under roms directory. Maybe firmware update helps…
I also had some problems in the past with CAknNoteDialog and capturing the key that was pressed to dismissing the dialog. According to S60 docs it should have worked, but it didn’t. My solution was to create my own Dialog class for the key config. It’s really hacked together in few minutes, but it’s good enough for the purpose (it’s not going into any platform, but it does what is shoud :).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class CAntKeyDialog : public CAknNoteDialog
{
public:
CAntKeyDialog(const TTone aTone, const TTimeout aTimeout);
        ~CAntKeyDialog();
    TInt RunKeyDialogLD( const TDesC; aText);
private:
    TKeyResponse OfferKeyEventL(const TKeyEvent aKeyEvent,TEventCode aType);
    TInt iKeyScanCode;
    CActiveSchedulerWait* iWait;
};
CAntKeyDialog ::CAntKeyDialog(const TTone aTone, const TTimeout aTimeout)
:CAknNoteDialog(aTone,aTimeout)
    {
    }
//just overwrite the default function :)
TKeyResponse CAntKeyDialog::OfferKeyEventL(const TKeyEvent aKeyEvent,TEventCode aType)
{
    if( aType == EEventKeyDown)
        {
        //save the scancode
        if( aKeyEvent.iScanCode == EStdKeyDevice1 || aKeyEvent.iScanCode == 1)
        	{
        	//skip
        	iKeyScanCode = 0;
        	}
        else
        	iKeyScanCode = aKeyEvent.iScanCode;
        iWait->AsyncStop();
        StaticDeleteL(this);
        }
   return EKeyWasConsumed;
}
//just overwrite the default function :)
TInt CAntKeyDialog::RunKeyDialogLD( const TDesC aText)
    {
    if( iWait )
    	{
    	delete iWait;
    	iWait = NULL;
    	}
    iWait = new (ELeave) CActiveSchedulerWait();
    CAknNoteDialog::SetTextL( aText );
    CAknNoteDialog::ExecuteDlgLD( R_INFORM_USER );
    iWait->Start();
    delete iWait;
    iWait = NULL;
    return iKeyScanCode;
    }

Using the dialog class is pretty simple. The S60 documentation promised the CAknNoteDialog to work in this way too…

1
2
dialog = new (ELeave) CAntKeyDialog(CAknNoteDialog::ENoTone,CAknNoteDialog::ENoTimeout);
iSettings.iScanKeyTable[11] = dialog->RunKeyDialogLD( *textResource);
This post is licensed under CC BY 4.0 by the author.

AntSnes release 0.4

AntSnes release 0.5 : It’s still silent

Comments powered by Disqus.