lc-soft/LCUI

Connecting Frontend to Backend #260

MichealShinoda posted onGitHub

I couldn't find any information on how to connecting frontend (button clicks) to backend. Let's say I have a button like this:

<w type="button" class="btn ml-3">Start Application</w>

How can I add click event to the xml file and program it in C? Thanks


Here are the steps:

  1. Add id attribute to xml element
  2. Call LCUIWidget_GetById() to get the widget
  3. Call Widget_BindEvent() to bind the click event of the widget

Examples for reference:

https://github.com/lc-soft/LCUI/blob/ea409f1339580c2f5267597a134c0a8c17d1e5e5/test/helloworld.c#L1-L33

https://github.com/lc-soft/LCUI/blob/ea409f1339580c2f5267597a134c0a8c17d1e5e5/test/helloworld.xml#L1-L11

posted by lc-soft over 3 years ago

Worked like charm!

posted by MichealShinoda over 3 years ago

Fund this Issue

$0.00
Funded

Pull requests