Languages

Menu
Sites
Language
subclassing Panel control

Hi,

Is it possible to subclass Tizen::Control::Panel which comes from XML file (created by UI Builder)?

I would like to load bitmap in OnIntializing() and draw bitmap as background in OnDraw().

Unfortunatelly, explicitly  is not possible to set a bitmap as background only SetBackgrondColor() is available.

 

Thanks.

slaw

 

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

8 Replies
you can set label in the lowest level of the panel and update its background image you can subclass panel easy... don't know about panel from UI builder
Slawek Kowalski
Yes, I did it as you said. But I have other issue. I created a custom CheckButton and can't force Tizen to call OnDraw() where I draw bitmaps for every states checked/unchecked. Even I call OnDraw() on my own, none change is visible. Is is not possible to override OnDraw() for CheckButton? I thought that every Control can override with drawing method. class CustomCheckBox : public Tizen::Ui::Controls::CheckButton { public: CustomCheckBox(); virtual ~CustomCheckBox(); virtual result OnInitializing(void); virtual result OnTerminating(void); virtual result OnDraw(void); ... result CustomCheckBox::OnDraw() { result r = E_SUCCESS; Canvas* pCanvas = GetCanvasN(); Bitmap* bmp; if (pCanvas != null) { bmp = bmpActive; if (!this->IsEnabled()) { bmp = bmpDisabled; } else { if (this->IsSelected()) { bmp = bmpPressed; } } pCanvas->DrawBitmap(*(new Point(0,0)), *bmp); delete pCanvas; } return r; }
I don't know ... I have sub-classed panel, container and form before but not CheckButton
Siddharth Singh
If u call Draw for checkbutton it will in turn call OnDraw().
Slawek Kowalski
It dosen't work. Neither Draw nor Invalidate call OnDraw() in case CheckButton. Maybe work for others controls.
Siddharth Singh
Yes,i verified the OnDraw method is available only for certain UI controls such as Frame,Form,Panel etc. The OnDraw method of these classes can be over-ridden. For your case i think you can draw the bitmap on the Canvas in ActionPerformed method as below: Canvas* pCanvas = GetCanvasN(); pCanvas->DrawBitmap(Rectangle(0, 0, 720,1280), *pBitmap1);
Slawek Kowalski
Yes, is not possible to override OnDraw for CheckButton. I figured it out by subclassing Button + extra code to simulate checkbutton. Easy to implement and work excellent. Of course I use UI Builder.
Jaewon Cho
OnDraw() callback is a method of Container class. but, CheckButton is not inherited from Container class. Therefore, you can't override OnDraw() callback for CheckButton. It can make display error if you call the GetCanvasN() function outside of OnDraw() function. So, I suggest you to make custom control by inheriting Container class.