cancel
Showing results for 
Search instead for 
Did you mean: 

Lines and Shapes inside a ListLayout

Dfarr.1
Senior

I have a layout that uses multiple nested custom containers.

View -> MenuCustomContainer -> ListLayout

The list layout is populated with:

MenuItemCustomContainer -> (3 x EditableCustomContainer + Lines and Shapes)

Part of my visual layout includes a few Line objects and Shape objects to create formatting, menu item separation, and indicators.

No matter how I do it, if there is a visible Line or Shape in either MenuItemCustomContainer or EditableCustomContainer inside that ListLayout my application crashes when touchgfx attempts to draw the screen.

Things I've tried so far:

  1. I've stepped through all my code. It all runs fine. Until it comes time to actually draw. Stack trace
  2. I moved the Lines and Shapes down into EditableCustomContainer. Same behavior.
  3. I've removed all my code completely and manually drawn the Line/Shape elements and set them to Visible from touchgfx gui itself with no later modifications in code. Exactly the same behavior.
  4. If I draw Line or Shape in View, or in MenuCustomContainer. No issues. Everything works fine.
  5. This is a weird one. If I draw Line or Shape inside MenuItemCustomContainer then directly include it in MenuCustomContainer (but not inside ListLayout:(

View -> MenuCustomContainer -> MenuItemCustomContainer -> Line/Shape

This works fine. AND, all the MenuItemCustomContainer still inside the ListLayout now work properly! But only as long as I have that extra MenuItemCustomContainer.

I feel like I'm missing something like an invalidate linked to the ListLayout or something. But I haven't been able to pin it down yet.

Any ideas would be appreciated.

4 REPLIES 4
Dfarr.1
Senior

Here's the stack trace if its helpful:

__assert_func() at 0x8088e9c

touchgfx::Canvas::Canvas() at 0x8085d3a

touchgfx::Line::drawCanvasWidget(touchgfx::Rect const&) const at 0x8078608

touchgfx::CanvasWidget::draw(touchgfx::Rect const&) const at 0x807815a

touchgfx::Screen::JSMOC() at 0x807bd74

Alexandre RENOUX
Principal

Hello Dfarr.1,

Maybe your canvas buffer is too small.

Could you try increasing its size ?

/Alexandre

zzzzz
Senior

Did you set canvas buffer? The line is a canvas widget. Users need to set proper canvas buffer to make it work.

In the simulator, canvas buffer is set in main.cpp.

   touchgfx::CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);

Dfarr.1
Senior

That's going to be the problem. I didn't even realize there were different categories of widgets. Sounds like I've got some more reading to do.

Why does dropping a copy of the MenuItemCustomContainer directly into MenuCustomContainer cause all the menu item instances inside the listLayout to draw correctly? This workaround actually works even if the dummy copy of the menu item has its visibility set to false.