Problem with CAknIpFieldEditor drawing

Login to reply to this topic.
Tue, 2005-08-02 10:39
Joined: 2005-07-07
Forum posts: 34
Hi All,

I use CAknIpFieldEditor but I have a problem with drawing of this control Sad

I hava CCoeControl witch content  CAknIpFieldEditor, but when it called CCoeControl ->Draw() , CAknIpFieldEditor isn't repainted!
Here is my Code:

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

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

void CallWatcherHttpContainer::ConstructL(const TRect& aRect)
{
   
    CreateWindowL();
    SetRect(aRect);
   
    iGTextEdMobileNumber = new (ELeave) CEikGlobalTextEditor;
    iGTextEdMobileNumber->SetContainerWindowL(*this);
    iGTextEdMobileNumber->ConstructL(static_cast<CCoeControl*>(this), 1, 100, EAknEditorFlagDefault, EGulFontControlAll, EGulNoSymbolFonts);
    iGTextEdMobileNumber->SetExtent( TPoint(37, 40), TSize(100,20));
  //iGTextEdMobileNumber->SetFocus(ETrue);   

TPoint top(20, 80);
TInetAddr lowAdr;
lowAdr.SetAddress(KInetAddrNone);
TInetAddr highAdr;
highAdr.SetAddress(KInetAddrAll);
   
iIpEditor = CAknIpFieldEditor::NewL(lowAdr, highAdr, lowAdr);
iIpEditor->SetContainerWindowL(*this);
iIpEditor->SetExtent(top, TSize(100,20));
iIpEditor->SetFocus(ETrue);
   
ActivateL();
}

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

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

void CallWatcherHttpContainer::Draw(const TRect& aRect) const
    {
    // Get the standard graphics context
    CWindowGc& gc = SystemGc();
    TRect rect = Rect();
    gc.Clear(rect);
    gc.SetBrushColor(KRgbGray);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.DrawRect(rect);

   iGTextEdMobileNumber->Draw(rect);
  //iIpEditor - how can I use Draw for this control   
   
   }


TKeyResponse CallWatcherHttpContainer::OfferKeyEventL(
      const TKeyEvent& aKeyEvent,TEventCode aType)
   {
   // only  the key press, not the key up/down event

   if (aType == EEventKey)
   {
                   if (iIpEditor->IsFocused())
       {
         return iIpEditor->OfferKeyEventL(aKeyEvent, aType);
        }
   }
      
   // Return the default functionality
   return CCoeControl::OfferKeyEventL(aKeyEvent, aType);
   }


TCoeInputCapabilities CallWatcherHttpContainer::InputCapabilities() const
   {
   // This class does not implement any 'unusual' input capabilities
   return TCoeInputCapabilities::ENone;
   }

Thanks a lot !

Tue, 2005-08-02 11:38
Joined: 2004-12-03
Forum posts: 192
Re: Problem with CAknIpFieldEditor drawing
are CountComponentControls and ComponentControl functions correct?
Tue, 2005-08-02 12:08
Joined: 2005-07-07
Forum posts: 34
Re: Problem with CAknIpFieldEditor drawing
Hi, Core

CountComponentControl is 0!
How can I add this controls in to parent CCoeControl.
This is my .h file:

#include <coecntrl.h>
#include <eikedwin.h>
#include <eikrted.h>
#include <gulcolor.h>
#include <eiklabel.h>
#include <aknipfed.h>
#include "FileManager.h"

class CEikGlobalTextEditor;
class CAknIpFieldEditor;

class CallWatcherHttpContainer : public CCoeControl
{
public:
    static CallWatcherHttpContainer* NewL(const TRect& aRect);
    static CallWatcherHttpContainer* NewLC(const TRect& aRect);
    ~CallWatcherHttpContainer();
    CallWatcherHttpContainer(void);
   
public:   // from CCoeControl
    void Draw(const TRect& aRect) const;
   
   
     TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);

    TCoeInputCapabilities InputCapabilities() const;
    CEikGlobalTextEditor*   iGTextEdMobileNumber;
    CAknIpFieldEditor*       iIpEditor;

private:
   
    void ConstructL(const TRect& aRect);
   
};

Thanks for replay Wink
Tue, 2005-08-02 12:25
Joined: 2005-07-07
Forum posts: 34
Re: Problem with CAknIpFieldEditor drawing
Hi again Core,
I solved my problem Smiley
I was forget to override this 2 methods - CountConponentControls and ComponentControls

Thanks for right way!
Tue, 2005-08-02 12:32
Joined: 2004-12-03
Forum posts: 192
Re: Problem with CAknIpFieldEditor drawing
I was writing the solution just when you posted your message Smiley)
`Warning - while you were typing a new reply has been posted. You may wish to review your post.`
Tue, 2005-08-02 13:50
Joined: 2005-07-07
Forum posts: 34
Re: Problem with CAknIpFieldEditor drawing
Hello Core

New problem with this CAknIpFieldEditor Sad

Now when I create control with such type, I lose the tabbar in my the parent form. I tab witch content CAknIpFieldEditor the form lose tabbar  up.

Any suggestions ?
Tue, 2005-08-02 13:59
Joined: 2004-12-03
Forum posts: 192
Re: Problem with CAknIpFieldEditor drawing
mmm... please, repeat your question Smiley
Tue, 2005-08-02 14:04
Joined: 2005-07-07
Forum posts: 34
Re: Problem with CAknIpFieldEditor drawing
my english is very bad sorry Smiley

The problem is following:

I have one view (tabbar) and in to view there are 2 controls GlobalTextEdit and CAknIpFieldEditor. When I'm in state edit my tabbar hide. (whne i have active cursor the tabbar hide and there is input type instead it - abc, Abc, 123)
Wed, 2005-08-03 06:44
Joined: 2004-12-03
Forum posts: 192
Re: Problem with CAknIpFieldEditor drawing
mmm... Smiley
try to add
Code:
gc.SetClippingRect(aRect);
in Draw function
  • Login to reply to this topic.