×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    Question Descriptor Problem

    i have ip address and port stored in a TDesC, the ip is written as a string and port as a int or long into the buffer. now i have to recover them as TUint32 type variables. please help me...
    thank you.

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: Descriptor Problem

    Hi,

    if you have and address in buffer an d you need to make it TUint32, one way could be(there are more ways!....):

    TInetAddr addr;
    addr.Input( ipAddress );
    TUint32 addr2 = addr.Address();

    Bye
    STeN

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    Smile Re: Descriptor Problem

    thanks sten,

    one more thing. i need to extract a TUint32 from a TDes. can you advise me in this regard. i am using a very inefficient process of scanning byte by byte of the buffer and then calculating the integer.

    anyway people like you are a boon to newcomers like me. thanks once again.

    Regards,
    Praveen

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: Descriptor Problem

    Hi,

    there is class named TLex - it is used in Symbian for extracting numbers from descripotors.

    Bye
    STeN

  5. #5
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    Re: Descriptor Problem

    hi sten,

    thanks for the support. i now have a prototype of my application. all that is left is to make it more attractive. i want to have a bitmap as background in the views but there isnt any documentation in this regard.i have heard that we can even have background image for objects like editors and lists. can you suggest me some useful resource where i can find relevant information. if its simple just suggest me the classes to use. thank you once again for your patient support.

    regards,
    Praveen

  6. #6
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: Descriptor Problem

    Hi,

    sorry, I never put any background image under our controls. I'm not sure if this is easy or not, beacue all controls must be transapernt as I thik.. On 7.0s and higher Symbian on S60 we use skins...

    Bye
    STeN

  7. #7
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    Re: Descriptor Problem

    Dear Sten,

    I found the way to add background images to controls. its pretty easy.

    _LIT(FileName, "z:\\system\\APPS\\MULTIVIEWS\\images.mbm");

    in containers ConstructL add this

    iBitmap = new (ELeave) CFbsBitmap();
    iBitmap->Load(FileName, 0, EFalse);

    then in the draw function add this

    gc.DrawBitmap(aRect,iBitmap);

    thats it. it works fine.

    then i need your help again.
    in my application i am using Views and i wrote the application engine seperately. the engine needs access to all the views and container clases all the time irrespective of whether they are active or not. so contrary to common practice in the DoDeactivateL() i just remove the view from the stack than removing the view from stack and deleting the respective container class. it works fine. but when i reactivate the view the view is drawn but the container with the component controls is not being updated. effectively only the respective Menubar is activated but the controld like list box are not being drwan. i will include the view class and container class here. please please help me.

    thank you,

    Regards,
    Praveen.
    //////////////////////////////////////////
    view class
    ///////////////////////////////////////////

    CMultiViewsView2* CMultiViewsView2::NewL()
    {
    CMultiViewsView2* self = CMultiViewsView2::NewLC();
    CleanupStack::Pop(self);
    return self;
    }

    CMultiViewsView2* CMultiViewsView2::NewLC()
    {
    CMultiViewsView2* self = new (ELeave) CMultiViewsView2();
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }

    CMultiViewsView2::CMultiViewsView2()
    {
    // No implementation required
    }

    CMultiViewsView2::~CMultiViewsView2()
    {
    // No implementation required
    }

    void CMultiViewsView2::ConstructL()
    {
    BaseConstructL(R_MULTIVIEWS_VIEW2);
    }


    TUid CMultiViewsView2::Id() const
    {
    return TUid::Uid(EMultiViewsView2Id);
    }

    void CMultiViewsView2:oActivateL(const TVwsViewId& /*aPrevViewId*/,
    TUid /*aCustomMessageId*/,
    const TDesC8& /*aCustomMessage*/)
    {
    if(!(iContainer))
    {
    iContainer = CMultiViewsContainer2::NewL(ClientRect());
    iContainer->SetMopParent(this);
    }
    AppUi()->AddToStackL(*this, iContainer);

    }

    void CMultiViewsView2:oDeactivate()
    {
    if (iContainer)
    {
    AppUi()->RemoveFromStack(iContainer);
    //delete iContainer;
    //iContainer = NULL;
    }
    }
    // ---------------------------------------------------------
    // CMultiViewsView2::HandleClientRectChange()
    // Handles client rect change.
    // ---------------------------------------------------------
    void CMultiViewsView2::HandleClientRectChange()
    {
    if (iContainer)
    {
    iContainer->SetRect(ClientRect());
    }
    }

    void CMultiViewsView2::HandleCommandL(TInt aCommand)
    {
    if (aCommand == EMultiViewsSwitchToView3)
    {
    AppUi()->ActivateLocalViewL(TUid::Uid(EMultiViewsView3Id));
    }
    else if (aCommand == EMultiViewsSwitchToView1)
    {
    AppUi()->ActivateLocalViewL(TUid::Uid(EMultiViewsView1Id));
    }
    else
    {
    AppUi()->HandleCommandL(aCommand);
    }
    }

    /////////////////////////////
    container class
    ////////////////////////////

    CMultiViewsContainer2* CMultiViewsContainer2::NewL(const TRect& aRect)
    {
    CMultiViewsContainer2* self = CMultiViewsContainer2::NewLC(aRect);
    CleanupStack::Pop(self);
    return self;
    }

    CMultiViewsContainer2* CMultiViewsContainer2::NewLC(const TRect& aRect)
    {
    CMultiViewsContainer2* self = new (ELeave) CMultiViewsContainer2;
    CleanupStack::PushL(self);
    self->ConstructL(aRect);
    return self;
    }

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

    /*
    TBuf<KBufLength> text;

    iCoeEnv->ReadResource(text, R_MULTIVIEWS_VIEW2_LABEL1);
    iLabel1 = new (ELeave) CEikLabel;
    iLabel1->SetContainerWindowL(*this);
    iLabel1->SetTextL(text);
    iLabel1->SetExtent(LIST_LABEL_POS, iLabel1->MinimumSize());
    iLabel1->OverrideColorL( EColorLabelTextEmphasis, KRgbWhite);
    iLabel1->SetEmphasis( CEikLabel::EPartialEmphasis ); */

    iTextListBox = new (ELeave) CAknSingleNumberStyleListBox();
    //iTextListBox->SetMopParent(this);
    iTextListBox->ConstructL(this,EAknListBoxSelectionList);
    iTextListBox->SetContainerWindowL(*this);

    iTextListBox->CreateScrollBarFrameL();
    iTextListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
    CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
    TRect lbRect = Rect();
    //lbRect.Shrink(10,14);
    iTextListBox->SetRect(lbRect);

    iTextListBox->SetFocus(ETrue);
    //iNamesArray = static_cast<CDesCArray*>(iTextListBox->Model()->ItemTextArray());
    //CleanupStack::PopAndDestroy();
    //iBitmap = new (ELeave) CFbsBitmap();
    //iBitmap->Load(FileName, 1, EFalse);
    SetRect(aRect);
    ActivateL();
    }
    // Destructor
    CMultiViewsContainer2::~CMultiViewsContainer2()
    {
    //delete iLabel1;
    delete iTextListBox;
    }
    TInt CMultiViewsContainer2::CountComponentControls() const
    {
    return KNumberOfControls;
    }

    void CMultiViewsContainer2:raw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    TRect drawRect = Rect();
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.SetBrushColor(KRgbBlack);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    //gc.DrawBitmap(aRect,iBitmap);
    gc.DrawRect(aRect);
    //iTextListBox->View();
    }

    CCoeControl* CMultiViewsContainer2::ComponentControl(TInt aIndex) const
    {
    switch (aIndex)
    {
    //case EListPrompt:
    //return iLabel1;
    case EList:
    return iTextListBox;
    default:
    return NULL;
    }
    }
    // ---------------------------------------------------------
    // CMultiViewsContainer2::SizeChanged()
    // Called by framework when the view size is changed
    // (other items were commented in a header).
    // ---------------------------------------------------------
    void CMultiViewsContainer2::SizeChanged()
    {
    iTextListBox->SetRect(Rect());
    }
    // ---------------------------------------------------------
    // CMultiViewsContainer2::OfferKeyEventL(...)
    // Notify key events to editors.
    // (other items were commented in a header).
    // ---------------------------------------------------------
    //
    TKeyResponse CMultiViewsContainer2::OfferKeyEventL(
    const TKeyEvent& aKeyEvent, TEventCode aType)
    {
    /*if (iTextListBox)
    {
    if (iTextListBox->IsFocused())
    {
    return iTextListBox->OfferKeyEventL(aKeyEvent, aType);
    }
    }
    if (aKeyEvent.iCode == EKeyDevice3) //EKeyOk
    {
    if (iTextListBox->CurrentItemIndex() >= 0)
    {
    HBufC* info = CTR->DlManager()->CreateHitInfoL(iTextListBox->CurrentItemIndex());
    CleanupStack::PushL(info);
    //CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
    //dlg->PrepareLC( R_MESSAGE_QUERY );
    //dlg->SetMessageTextL(info->Des());
    //dlg->QueryHeading()->SetTextL(_L("File info"));
    //dlg->RunLD();

    CleanupStack::PopAndDestroy();
    }
    }
    return EKeyWasNotConsumed;*/
    if (aType == EEventKey)
    {
    switch (aKeyEvent.iCode)
    {
    case EKeyUpArrow:
    case EKeyDownArrow:
    return iTextListBox->OfferKeyEventL(aKeyEvent, aType);
    case EKeyDevice3: //EKeyOk
    {
    if (iTextListBox->CurrentItemIndex() >= 0)
    {
    HBufC* info = CTR->DlManager()->CreateHitInfoL(iTextListBox->CurrentItemIndex());
    CleanupStack::PushL(info);

    /*CAknNoteDialog* note = new (ELeave) CAknNoteDialog;
    CleanupStack::PushL(note);
    note->SetTextL(*info);
    CleanupStack::Pop();
    note->PrepareLC(R_HIT_INFO_NOTE);
    note->RunLD();*/
    //CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
    //dlg->PrepareLC( R_MESSAGE_QUERY );
    //dlg->SetMessageTextL(info->Des());
    //dlg->QueryHeading()->SetTextL(_L("Hit info"));
    //dlg->RunLD();

    CleanupStack::PopAndDestroy();
    }
    }
    break;
    default:
    return EKeyWasNotConsumed;
    }
    }


    }
    // ---------------------------------------------------------
    // CMultiViewsContainer2::HandleControlEventL(
    // CCoeControl* aControl,TCoeEvent aEventType)
    // (other items were commented in a header).
    // ---------------------------------------------------------
    //
    void CMultiViewsContainer2::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    }

    TInt CMultiViewsContainer2::GetCurrentItem()
    {
    return iTextListBox->CurrentItemIndex();
    }

  8. #8
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    Re: Descriptor Problem

    Hi Sten,
    i Found the answer to my problem regarding which i posted yesterday.

    i just had to use MakeVisible() in the DoActivatel() and DoDeActivatel() of the view class. Thank you for your patient support.

    Regards,
    Praveen.

  9. #9
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    Re: Descriptor Problem

    Dear Sten,

    With your help i am done with beta of our product. Thank you very much. For our next version we need to use wap. Do you have any experience using RHTTPSession with WSP/WSP as protocol. there is absolutely no documentation in this regard. i donno why nokia does not support wap development. Even they have discontinued wap API from symbian os v8.0. if you can please help me.
    Thank you,

    Regards,
    Praveen

Posting Permissions

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