本文整理汇总了C++中ComboBox::SetDefaultItem方法的典型用法代码示例。如果您正苦于以下问题:C++ ComboBox::SetDefaultItem方法的具体用法?C++ ComboBox::SetDefaultItem怎么用?C++ ComboBox::SetDefaultItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComboBox
的用法示例。
在下文中一共展示了ComboBox::SetDefaultItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
//Entry point of the program
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow)
{
//Create a window
cWindow = Window(WindowProcedure, hThisInstance, "MealTrackApp", nCmdShow);
cWindow.Create("MealTrack - Untitled", 462, 375);
//Actually create the button with the window as its parent
RECT rEditBox = {16, 280, 272, 24};
cEditBox = EditBox(cWindow, rEditBox, "Disconnected");
cEditBox.SetReadOnly(1);
//Create the Button
RECT rButton = {304, 280, 128, 24};
cButton = Button(cWindow, rButton, "Start Meal", IDR_START_BUTTON);
cButton.SetEnabled(0);
//Create the listbox
RECT rListBox = {16, 16, 272, 272};
cListBox = ListBox(cWindow, rListBox, "MealListBox");
//Meal wait box
RECT rLabelDelay = {304, 16, 128, 16};
RECT rEditDelay = {304, 32, 128, 24};
cLabelDelay = Label(cWindow, rLabelDelay, "Meal wait (seconds)");
cEditDelay = EditBox(cWindow, rEditDelay, "10");
//Create Date format box
RECT rLabelDate = {304, 64, 128, 16};
RECT rComboDate = {304, 80, 128, 24};
cLabelDate = Label(cWindow, rLabelDate, "Date format");
cComboDate = ComboBox(cWindow, rComboDate, "ComboBoxDate");
cComboDate.AddItem("12 Hour AM/PM");
cComboDate.AddItem("24 Hour");
cComboDate.SetDefaultItem(1);
//Record format box
RECT rLabelRecord = {304, 112, 128, 16};
RECT rComboRecord = {304, 128, 128, 24};
cLabelRecord = Label(cWindow, rLabelRecord, "Record change type");
cComboRecord = ComboBox(cWindow, rComboRecord, "ComboBoxRecord");
cComboRecord.AddItem("Increases");
cComboRecord.AddItem("Decreases");
cComboRecord.AddItem("Both");
cComboRecord.SetDefaultItem(1);
//Record format box
RECT rLabelSensitivity = {304, 160, 128, 16};
RECT rComboSensitivity = {304, 176, 128, 24};
cLabelSensitivity = Label(cWindow, rLabelSensitivity, "Sensitivity");
cComboSensitivity = ComboBox(cWindow, rComboSensitivity, "ComboBoxSensitivity");
cComboSensitivity.AddItem("0.01 g");
cComboSensitivity.AddItem("0.02 g");
cComboSensitivity.AddItem("0.03 g");
cComboSensitivity.AddItem("0.04 g");
cComboSensitivity.AddItem("0.05 g");
cComboSensitivity.AddItem("0.06 g");
cComboSensitivity.AddItem("0.07 g");
cComboSensitivity.AddItem("0.08 g");
cComboSensitivity.AddItem("0.09 g");
cComboSensitivity.SetDefaultItem(2);
//Custom function to creeate window
CreateWindowMenu(cWindow);
//Message loop
MSG msg;
while (cWindow.GetMessage(&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// The program return-value is 0 - The value that PostQuitMessage() gave
return msg.wParam;
}