EmWin 2-Day Accelerated Instance Tutorial 002_ multiple page window transitions

Source: Internet
Author: User

Note: (1) Open the "Exe\guisimulationdebug.exe" under the project catalog to see the effect. (2) After reading the tutorial 000~005 will basically use Emwin to do the project, other chapters can be consulted when necessary.
Using Emwin to do the interface, you can simply understand that each C file corresponds to a page, if you want to design multiple pages of the interface what to do? Generate multiple interface C files and implement the interface switching program in the action trigger message of the callback function using the Hide/Show Page function: Wm_hidewindow () and Wm_showwindow ().
When the interface has more than one page to switch the display, there are two ways to achieve: (1) Hide/show: When the program starts to create all the page window, the program runs to hide the currently no need to display the page, while displaying the current need to display the page; (2) Delete/ Created by: When the program starts, it creates a page window that needs to be displayed, and the program runs to delete pages that are not currently displayed, while creating the page that currently needs to be displayed.
The fundamental difference between the two approaches is that the first (1) method takes up more memory because all the pages are real. For simple interface applications, or the CPU has enough RAM, it is recommended to use the hidden/display method, because the deletion/creation method involves the application and release of dynamic memory, improper handling or the program is not rigorous prone to memory errors caused the crash phenomenon, and the deletion/creation method due to the need to create a window to switch pages, So it's slower to switch pages than hide/show.
This only shows the way to do a page window switch by hiding/showing, using the Emwin two window management API functions:
void Wm_hidewindow (Wm_hwin hwin); Hide window function, Hwin is the handle of the window
void Wm_showwindow (Wm_hwin hwin); Display window function, Hwin is the handle of the window


......
Case Wm_notify_parent://Action trigger message processing (the program will run here), such as clicking the button, clicking on the edit box (any action), etc...
Id = Wm_getid (PMSG->HWINSRC);
NCode = pmsg->data.v;
Switch (Id) {
Case id_button_1://id is clicked for the id_button_1 button
Switch (NCode) {
casewm_notification_clicked://Press the action message
Break
casewm_notification_released://Bounce Action Message
Wm_hidewindow (Hpage[0]); Hide Page0
Wm_showwindow (hpage[1]);//Display Page1
Break
}
Break
}
Break
......



source/software Download

EmWin 2-Day Accelerated Instance Tutorial 002_ multiple page window transitions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.