lpcware

emWin submenu of submenu

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by pcalton on Fri May 31 13:27:30 MST 2013

I am trying out the different widgets available in emWin and as part of my testing I am attempting to make a submenu of a submenu using the following code: 


<span class="Apple-tab-span" style="white-space: pre;"> </span>hSubMenu = MENU_CreateEx(0,0,85,105,0,WM_CF_SHOW, MENU_CF_VERTICAL, ID_MENU_0_SUB_ALARM);


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hItem, "Alarms", ID_MENU_0_SUB_ALARM, 0, hSubMenu);


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hSubMenu, "View Active", ID_MENU_ALARM_VIEW, 0, 0);


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hSubMenu, "Clear All", ID_MENU_ALARM_CLEAR, 0, 0);


 


<span class="Apple-tab-span" style="white-space: pre;"> </span>hSubMenu2 = MENU_CreateEx(70,15,80,55,0,WM_CF_SHOW, MENU_CF_VERTICAL, ID_MENU_ALARM_TEMP_SENSOR);


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hSubMenu, "Temp Sensors &gt;", ID_MENU_ALARM_TEMP_SENSOR, 0, hSubMenu2);


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hSubMenu2, "Temp Sensor 1", ID_ALARM_TS1, 0, 0);


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hSubMenu2, "Temp Sensor 2", ID_ALARM_TS2, 0, 0);


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hSubMenu2, "Temp Sensor 3", ID_ALARM_TS3, 0, 0);


 


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hSubMenu, "Current", ID_MENU_ALARM_CURRENT, 0, 0);


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hSubMenu, "Voltage", ID_MENU_ALARM_VOLTAGE, 0, 0);


<span class="Apple-tab-span" style="white-space: pre;"> </span>AddMenuItem(hSubMenu, "Resistance", ID_MENU_ALARM_RESIST, 0, 0);


Unfortunately the 2nd level of submenu isnt offset correctly from the parent menu as shown in this image.


<div><span class="inline inline-left"><img class="image image-preview " src="http://lpcware.com/system/files/images/wrong%20offset.png" border="0" alt="" title="" width="129" height="138" /></span></div>

I have tried adding an offset when creating the submenu as in the code above, but this didnt seem to have any effect. Am I doing something wrong or is this just not possible with emWin?


<div>Thanks for any replies</div>

Outcomes