Conditionally initialize and set image object's bitmap using AppWizard

  • Hi everyone,

    I'm using AppWizard for an embedded application where an image object's bitmap (10 patterns ) will change after some specific signal.
    I'm using 10 separate interactions (Job = SETBITMAP) for that, each checking for an appropriate condition using code.

    Now, the image object must also be initialized depending on settings.
    I would like to avoid using another 10 INITDIALOG interactions (with the same Job and condition as above).

    Is there a way to use a common function to set bitmap?
    Can I skip the interaction and control the image object's bitmap through code?

    Thanks.

    Best Regards,
    Rowel

  • Hi,

    You can change the bitmap by triggering the SETBITMAP job.

    To do so you have to set up a APPW_PARA_ITEM structure with the desired information and call APPW_DoJob(). This might look like this:

    C
    aPara[0].v = 0;                                                    // - Index
      aPara[1].p = (_Switch) ? acBitmap2_30x30 : acBitmap_30x30;         // - INT: Pointer to Image-Data / EXT: Pointer to Image-Filename (EXT)
      aPara[1].v = 0;                                                    // - 0 (INT) / 1 (EXT)
      aPara[2].v = aSizeOfBm[_Switch];                                   // - FileSize
      APPW_DoJob(ID_SCREEN_00, ID_IMAGE_00, APPW_JOB_SETBITMAP, aPara);

    You will find a description of the parameter either in AppWizard.h or in the manual under the job description:
    https://www.segger.com/doc/UM03003_Ap…ml#List_of_jobs

    Attached is an example which changes the bitmaps on a timer event. Check out ID_SCREEN_00_Slots.c regarding the code.


    Best regards,
    Sven

  • Hi Sven,

    Thank you for the reply.

    I tried to run your sample code using the following environment, but the images does not change on TIMER signal. (The TIMER signal itself runs and so is the slot routine)

    Environment:
    ---
    AppWizard V1.24_6.22
    Microsoft Visual Studio Professional 2022 (64-bit) - Version 17.4.4
    Windows SDK Version 10.0.22000.0
    Platform Toolset v143
    ---

    I also tried to add a button that will do the same job, but I got the same output.
    Does the APPW_DoJob() API work for older (V1.24_6.22) AppWizard versions or do I need a newer one?

    I also hope the manual will be updated to include the documentation for APPW_DoJob().


    Thank you very much for your time.

    Best Regards,
    Rowel

  • Hi Rowel,

    Actually, in the latest version we have fixed an issue with job processing.

    I have updated the AppWizard version available for download on our website:
    https://www.segger.com/downloads/emwin/

    You might want to give it a try.

    Regards,
    Sven

    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: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

  • Hi Sven,

    With the latest version of AppWizard (V138_632d), I can confirm that the sample code is working (bitmaps are changing).
    Very nice.

    Unfortunately, I'm stuck with the older version.

    But I hope those who can use the latest version (including the future me) will find this info helpful.

    Thank you very much.

    Best Regards,
    Rowel

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!