-Windows CE programming (3rd edition)-5.2 Public controls (2)

Source: Internet
Author: User
Tags first string ibutton

//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// ///////////////////////
// 2006-03-05
// Since there have been a lot of things recently, we cannot translate the entire section and release it again, so we decided to adopt the distributed translation and distributed publishing method.
// Each time a part is translated, it will be published. After this section is fully translated, it will be summarized into a complete chapter.
//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// ///////////////////////
Translation: tellmenow
Combo box on the command bar
Compared with the drop-down list button, the combo box in the command bar is easier to implement. By calling the following function, you can add a combo box:
Hwnd commandbar_insertcombobox (hwnd hwndcb, hinstance hinst, int iwidth, uint dwstyle, word idcombobox, int iButton );
This function inserts a combo box on the left of the button indicated by the iButton parameter in the command bar. The width of the combo box is specified in the iwidth parameter, in pixels. Dwstyle specifies the style of the combo box. The allowed styles include any valid Windows CE combo box styles and window styles. When a combo box is created, the function automatically adds the ws_child and ws_visible flag. The idcombobox parameter is the ID of the combo box. This ID is used when a wm_command message is sent to notify the parent window event of the combo box. If experienced windows programmers know that the commandbar_insertcombobox function has solved all the problems that will occur when adding controls to the standard Windows toolbar, they should be very happy. To create a fully functional combo box in the command bar, all you need to do is call this function.

Once a combo box is created, you can program the combo box on the command bar in the same way as other independent combo boxes. Because the combo box is a subwindow of the command bar, you must pass the handle and ID of the command bar to the getdlgitem function to query the window handle of the combo box, as shown in the following code:
Hwndcombobox = getdlgitem (hwnd, idc_cmdbar), idc_combo ));
Because the wm_command message from the combo box is directly sent to the parent window of the command bar, the event handling the combo box is the same as that created in the top-level window of the application program as a child window.

ToolTips)
The tooltip is actually a small window. When the input pen is pressed on the control, the description text of the command bar button is displayed. The command bar uses its own special method to implement tooltip.

You can use the following function to add a tooltip to the command bar:
Bool commandbar_addtooltips (hwnd hwndcb, uint unumtooltips, lptstr lptooltips );
The lptooltips parameter points to the string pointer array. Unumtooltips is the number of elements in the string pointer array. Commandbar_addtooltips does not copy the string to its own bucket, but stores the position of the string array. This means that the memory zone containing the string array should not be released before the command bar is destroyed.

Each string in the array is the prompt Text of the control or separator on the command bar. Note that this does not include the menu above the command bar. The first string in the array becomes the tooltip for the first control or separator, The tooltip for the second control or separator, and so on. Therefore, even if the combo box and the separator Bar do not display a tooltip, they must occupy entries in the string array to ensure that all text matches the corresponding button.

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.