Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

So, I need to create an app with custom screens. Basically, I want to have the title/softkeys handled by BUIW on the custom screens, and some screens will be entirely done with BUIW widgets. From what I have read, it appears there are several possibilities:

- Custom widget
- Draw decorator
- Use IDISPLAY_* drawing calls?

The custom widget seems like overkill since you have to generate an ID and everything, and these widgets are going to be very very specific to this app. I'm not sure how to approach the draw decorator, since it needs a child widget. I don't want the child widget to actually do anything, so that is a bit unintuitive. I don't even know if IDISPLAY_ calls are possible because my brief testing seems like mixing them with Forms stuff is pretty nasty.

Anyone have any advice? It seems like the decorator approach is the simplest, but I dunno how to implement it...

So far, this is what I have tried:
(1) create a AEECLSID_DRAWDECORATORWIDGET
(2) do a DRAWHANDLERDESC_Init() and IDRAWDECORATOR_SetDraw() with your DrawHandler().
(3) then IDRAWDECORATOR_SetWidget() to wrap this DrawDecorator around a child widget. The SetExtent of the child is important here.
Your DrawHandler function gets called everytime the display needs updated. The DrawHandler() looks like this:
DrawHandler(void * me, ICanvas * piCanvas, int x, int y);
In your handler, you can use the ICanvas to get: ICANVAS_GetBitmap() or ICANVAS_GetDisplay(). You know the starting coordinates (x and y).
I think at this point, you know what to do. Does this help?
anh

So far, this is what I have tried:
(1) create a AEECLSID_DRAWDECORATORWIDGET
(2) do a DRAWHANDLERDESC_Init() and IDRAWDECORATOR_SetDraw() with your DrawHandler().
(3) then IDRAWDECORATOR_SetWidget() to wrap this DrawDecorator around a child widget. The SetExtent of the child is important here.
Your DrawHandler function gets called everytime the display needs updated. The DrawHandler() looks like this:
DrawHandler(void * me, ICanvas * piCanvas, int x, int y);
In your handler, you can use the ICanvas to get: ICANVAS_GetBitmap() or ICANVAS_GetDisplay(). You know the starting coordinates (x and y).
I think at this point, you know what to do. Does this help?
anh

Excellent. That worked. I used an instance of AEECLSID_STATICWIDGET for the child widget (with no label, and I never call its draw routines). Seems a little odd that you have to randomly pick an arbitrary child widget when you want to draw the whole thing yourself. I guess they expect you to use custom widgets for that type of thing, but it seems like a lot of hassle.
Thanks for the help.

Excellent. That worked. I used an instance of AEECLSID_STATICWIDGET for the child widget (with no label, and I never call its draw routines). Seems a little odd that you have to randomly pick an arbitrary child widget when you want to draw the whole thing yourself. I guess they expect you to use custom widgets for that type of thing, but it seems like a lot of hassle.
Thanks for the help.

don't forget to call DRAWHANDLERDESC_Call() as the API has instructed.
anh

don't forget to call DRAWHANDLERDESC_Call() as the API has instructed.
anh

The most lightweight widget is the border widget, I'd use that instead of a static widget.
As for custom widgets, you don't need to generate a class ID. Just call the widget constructor directly.
-Erik

The most lightweight widget is the border widget, I'd use that instead of a static widget.
As for custom widgets, you don't need to generate a class ID. Just call the widget constructor directly.
-Erik

anhn27 wrote:don't forget to call DRAWHANDLERDESC_Call() as the API has instructed.
anh
If I don't care about the child widget displaying, is there any reason I should still call it?

anhn27 wrote:don't forget to call DRAWHANDLERDESC_Call() as the API has instructed.
anh
If I don't care about the child widget displaying, is there any reason I should still call it?

Yep, I think that's OK.

Yep, I think that's OK.

I have implemented some draw decorators now to do custom screens and it's working well. Now, I need to have them redraw (like calling repaint in J2ME) themselves based on certain events. Is there any way I can force the widget to re-draw itself (and call my draw method)?
Thanks in advance
-Al

I have implemented some draw decorators now to do custom screens and it's working well. Now, I need to have them redraw (like calling repaint in J2ME) themselves based on certain events. Is there any way I can force the widget to re-draw itself (and call my draw method)?
Thanks in advance
-Al

alwold wrote:I have implemented some draw decorators now to do custom screens and it's working well. Now, I need to have them redraw (like calling repaint in J2ME) themselves based on certain events. Is there any way I can force the widget to re-draw itself (and call my draw method)?
Thanks in advance
-Al
I have found the answer, I think. This seems to work:
IWIDGET_Invalidate(widget, NULL, ICIF_REDRAW);

alwold wrote:I have implemented some draw decorators now to do custom screens and it's working well. Now, I need to have them redraw (like calling repaint in J2ME) themselves based on certain events. Is there any way I can force the widget to re-draw itself (and call my draw method)?
Thanks in advance
-Al
I have found the answer, I think. This seems to work:
IWIDGET_Invalidate(widget, NULL, ICIF_REDRAW);