Problem with phone and find box.

Login to reply to this topic.
Wed, 2007-02-14 13:40
Joined: 2006-12-12
Forum posts: 135
Hi all,

I have this code:

Code:

void CBestSalesContainerLocClientes::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    //TBuf<KBufLength> text;

_LIT(KDbCreateDb,"BestSales.db");
_LIT(KCEpoc32exData,"C:\\epoc32ex\\data\\");

// The database is contained in a permanent file store:
// "C:\epoc32ex\data\BestSales.db"

TParse name;
TInt fsret = fsSession.Connect(); // start a file session
if (fsret != KErrNone){
User::Leave(fsret);
}


fsSession.MkDirAll(KCEpoc32exData);
fsSession.Parse(KDbCreateDb,KCEpoc32exData,name);
//

iListBox = new ( ELeave ) CAknSingleGraphicStyleListBox( );
iListBox->ConstructL( this , 0 );
iListBox->SetContainerWindowL( *this );

Verifica(name.FullName());

CEikScrollBarFrame* scrollBar = iListBox->CreateScrollBarFrameL();
iListBox->SetRect(aRect.Size());
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
iListBox->SetFocus(ETrue);
iListBox->ActivateL();

iFindBox = CreateFindBoxL(iListBox, iListBox->Model(), CAknSearchField::EPopup);
if ( iFindBox )
{
iFindBox->MakeVisible( EFalse );
iFindBox->ActivateL();   // activate Find box.
iFindBox->SetFocus( ETrue );
}

    SetRect(aRect);
    ActivateL();
}


This works correctly in the emulator, but when i put it in the phone, i cant open the program. I comment this lines and the program works fine in the phone:

Code:

        /*iFindBox = CreateFindBoxL(iListBox, iListBox->Model(), CAknSearchField::EPopup);
if ( iFindBox )
{
iFindBox->MakeVisible( EFalse );
iFindBox->ActivateL();   // activate Find box.
iFindBox->SetFocus( ETrue );
}*/


What is wrong with the FindBox?

Thanks.

Developer for PalmOS and Symbian.

by Serginho


Wed, 2007-02-14 14:08
Joined: 2006-12-12
Forum posts: 135
Re: Problem with phone and find box.
Code:

        iFindBox = CreateFindBoxL(iListBox, iListBox->Model(), CAknSearchField::EFixed);
if ( iFindBox )
{
iFindBox->MakeVisible( EFalse );
iFindBox->ActivateL();   // activate Find box.
iFindBox->SetFocus( ETrue );
}


I use 'EFixed' and works fine. But i have other problem now... If i put 'MakeVisible( ETrue )', when I go to the screen, seens to be there the List, but what I got is like a big find box and I cant see the List.

Developer for PalmOS and Symbian.

by Serginho

Fri, 2007-03-02 18:20
Joined: 2006-12-12
Forum posts: 135
Re: Problem with phone and find box.
Eric... any ideia about this?!  Undecided

Huh

Developer for PalmOS and Symbian.

by Serginho

Fri, 2007-03-02 20:00
Joined: 2006-12-12
Forum posts: 135
Re: Problem with phone and find box.
 Afro

** ConstructL **
Code:

CAknSearchField::TSearchFieldStyle style(CAknSearchField::ESearch );
iFindBox = CreateFindBoxL( iListBox, iListBox->Model(), style );
iFindBox->MakeVisible( ETrue );


** CreateFindBoxL **
Code:

         CAknSearchField* findbox = NULL;

        if ( aListBox && aModel )
        {
                CAknFilteredTextListBoxModel* model = STATIC_CAST( CAknFilteredTextListBoxModel*, aModel );
                findbox = CAknSearchField::NewL( *this, aStyle, NULL, 30 );
                CleanupStack::PushL(findbox);
                model->CreateFilterL( aListBox, findbox );
                CleanupStack::Pop(findbox); // findbox

        }
        return findbox;


** SizeChanged **
Code:

        if (iFindBox) { SizeChangedForFindBox(); }
        TRect lb_rect=Rect();
        if ( iListBox )
        {
                if ( iFindBox )
                {
                        lb_rect.Resize(0, -27);
                }
                else
                {
                        lb_rect.Resize(0, 0);
                       
                }
                lb_rect.Move(0, 0);
                iListBox->SetRect(lb_rect);
        }
        if (iFindBox)
        {
                TRect edit_rect=Rect();
                edit_rect.SetHeight(28);
                edit_rect.Move(0, lb_rect.Height());
                iFindBox->SetRect(edit_rect);
                iFindBox->MakeVisible(ETrue);
                iFindBox->SetFocus(ETrue);
        }


** SizeChangedForFindBox **
Code:

        if ( iListBox && iFindBox )
        {
                TInt findWindowResourceId( R_AVKON_FIND_PANE );
                TInt listAreaResourceId( R_AVKON_LIST_GEN_PANE_X );
                TInt findWindowParentId( R_AVKON_MAIN_PANE_PARENT_NONE );
                TBool flagsOfPopup( ETrue );
        }



now its working fine!!!
Smiley Cheezy Grin

Developer for PalmOS and Symbian.

by Serginho

  • Login to reply to this topic.