Widget ID definitions in different windows

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Widget ID definitions in different windows

      Hello,

      I have two different windows.

      Window1 widget ids

      #define GUI_ID_WINDOW_0 (GUI_ID_USER + 0x00)
      #define GUI_ID_ICONVIEW0 (GUI_ID_USER + 0x01)

      #define GUI_ID_ICONVIEW1 (GUI_ID_USER + 0x02)
      ...

      Window2 widget ids

      #define GUI_ID_WINDOW_0 (GUI_ID_USER + 0x00)
      #define GUI_ID_ICONVIEW0 (GUI_ID_USER + 0x01)
      #define GUI_ID_ICONVIEW1 (GUI_ID_USER + 0x02)
      ...

      each window has a resource table which is used to create the widgets by using GUI_CreateDialogBox()
      My question is can two windows have same widget id's?

      On Window1 widget iconview1 released event i have deleted the current window by using WM_DeleteWindow()
      and created the window2 using GUI_CreateDialogBox()

      I get the following emwin error.




      When i modify the GUI ID's as below the error does not come.
      I have kept different ids for iconview widget in both windows.

      Window1 widget ids

      #define GUI_ID_WINDOW_0 (GUI_ID_USER + 0x00)
      #define GUI_ID_ICONVIEW0 (GUI_ID_USER + 0x01)
      #define GUI_ID_ICONVIEW1 (GUI_ID_USER + 0x02)
      ...

      Window2 widget ids

      #define GUI_ID_WINDOW_0 (GUI_ID_USER + 0x00)
      #define GUI_ID_ICONVIEW0 (GUI_ID_USER + 0x03)
      #define GUI_ID_ICONVIEW1 (GUI_ID_USER + 0x04)

      So if GUI id's for Iconview widget are same i get the error as above and if GUI id's are different i don't get any error.

      I get this error for iconview widgets only.

      My question is why the error is coming?
      What is the standard way of defining id's if 2 windows are used, each window with 2 iconview widgets?

      Thanks

      Regards,

      Anuj
    • Hi,

      all of the IDs of windows (and therefore widgets as well) have to be unique or else the creation of that window/widget will fail. To be on the safe side, use unique IDs for all windows and widgets.

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.