GUIBUILDER How to use button

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

  • GUIBUILDER How to use button

    Hello ,

    I am new at emwin , i am trying to make a simple application using guibuilder software just including one button , I am using stm32f429 , that card has a touchscreen.
    The freame that i created works and everything shows on the screen but i couldnt use the button. Can anybody explain me how to associate button to the touchscreen ? I have added the code created by guibulder. I have tried to add some code after case ID_BUTTON_0 (it is in the cbdialog function) in order to understand if the button is pressed , but nothing happens. What can i do for it ?


    Best Regards.
    Koray Kara.



    #include "DIALOG.h"

    #define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
    #define ID_BUTTON_0 (GUI_ID_USER + 0x01)

    static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
    { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 0, 0, 240, 320, 0, 0x0, 0 },
    { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 19, 114, 180, 94, 0, 0x0, 0 },
    // USER START (Optionally insert additional widgets)
    // USER END
    };

    static void _cbDialog(WM_MESSAGE * pMsg) {
    int NCode;
    int Id;
    // USER START (Optionally insert additional variables)
    // USER END

    switch (pMsg->MsgId) {
    case WM_NOTIFY_PARENT:
    Id = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'Button'
    switch(NCode) {
    case WM_NOTIFICATION_CLICKED:
    // USER START (Optionally insert code for reacting on notification message)
    // USER END
    break;
    case WM_NOTIFICATION_RELEASED:
    // USER START (Optionally insert code for reacting on notification message)
    // USER END
    break;
    // USER START (Optionally insert additional code for further notification handling)
    // USER END
    }
    break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
    // USER START (Optionally insert additional message handling)
    // USER END
    default:
    WM_DefaultProc(pMsg);
    break;
    }
    }

    WM_HWIN CreateFramewin(void);
    WM_HWIN CreateFramewin(void) {
    WM_HWIN hWin;

    hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
    return hWin;
    }
  • Hi,

    Before you can use the button you need to initialize the touch screen of your board (this is not part of emWin). Once the touch screen is set up you have to pass the touch coordinates to emWin. This is done e.g. by the function GUI_TOUCH_StoreStateEx(). Attached is a sample configuration which shows how the touch input can be processed.

    In this example we have a dedicated touch task running which checks every 25 ms if there is touch input. Please keep in mind that this is just a sample and needs to be adapted to your environment.

    Additional to that you might want to check out our sample project for the different ST devices. I recommend those for Embedded Studio, because there is a free trial version for Embedded Studio available. All you need is a J-Link (e.g. an onboard ST-Link converted into a J-Link).

    Here is one project for a STM32F4x9I Eval board:
    segger.com/admin/uploads/evalB…S_FS_GUI_IP_OS_160504.zip

    There are alo other projects available:
    segger.com/st-stm324x9i.html
    segger.com/st-stm32f429-discovery.html

    Regards,
    Sven
    Files
    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.