本文整理汇总了C++中Menu::EditItem方法的典型用法代码示例。如果您正苦于以下问题:C++ Menu::EditItem方法的具体用法?C++ Menu::EditItem怎么用?C++ Menu::EditItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::EditItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToggleScaleMenu
void ToggleScaleMenu(bool scaleIsActive) {
if (scaleIsActive) { //If scale is active
mScale.EditItem(ID_SCALE_CONNECT, "&Disconnect");
mScale.EditItem(ID_SCALE_ZERO, "&Zero", 0);
cButton.SetEnabled(1);
} else {
mScale.EditItem(ID_SCALE_CONNECT, "&Connect");
mScale.EditItem(ID_SCALE_ZERO, "&Zero", MF_DISABLED);
cButton.SetEnabled(0);
}
}
示例2: Meal
void Meal(void* args) {
//Disable buttons/settings
cButton.SetText("End Meal");
cEditDelay.SetEnabled(0);
cComboDate.SetEnabled(0);
cComboRecord.SetEnabled(0);
cComboSensitivity.SetEnabled(0);
mScale.EditItem(ID_SCALE_ZERO, "&Zero", MF_DISABLED);
//Get Variables
char* tmpWait = new char[255];
cEditDelay.GetText(tmpWait);
iMealWait = atoi(tmpWait);
if (iMealWait==0) iMealWait = 10;
mCompare = cComboRecord.GetSelectedItem();
mSensitivity = ((float)cComboSensitivity.GetSelectedItem()+1.0)/100.0;
//Initialize the first weight
AddCurrentValue();
//Activate the meal
bMealActive = true;
while(bMealActive) {
//So if the scale is not stable, set the current time to when the scale was last stable
if (!scale->IsStable()) uLastStable = time(0);
if (time(0) - uLastStable >= iMealWait) {
if (scale!=NULL && scale->IsConnected()) {
if (fabs(scale->GetWeight() - fLastWeight) >= mSensitivity) {
if ((mCompare == 0 || mCompare == 2) && scale->GetWeight() > fLastWeight) AddCurrentValue();
if ((mCompare == 1 || mCompare == 2) && scale->GetWeight() < fLastWeight) AddCurrentValue();
}
}
}
//Sleep for .1 second
Sleep(100);
}
//Check and see if the person saved the file
CheckAndSave();
//Enable them
cButton.SetText("New Meal");
cEditDelay.SetEnabled(1);
cComboDate.SetEnabled(1);
cComboRecord.SetEnabled(1);
cComboSensitivity.SetEnabled(1);
mScale.EditItem(ID_SCALE_ZERO, "&Zero", 0);
}
示例3: HandleMenu
void HandleMenu(HWND hWnd, DWORD opt) {
switch(opt) {
case ID_SCALE_CONNECT:
cEditBox.SetText("Trying to communicate with the scale...");
mScale.EditItem(ID_SCALE_CONNECT, "&Connecting...", MF_DISABLED);
_beginthread(ScaleConnect, 0, (void*) hWnd);
break;
case ID_FILE_NEW:
if (!bSaved && vMealItems.size() > 0) {
switch(MessageBox(hWnd, "You haven't saved the current meal, would you like to?","Hold Up!", MB_YESNOCANCEL | MB_ICONINFORMATION)) {
case IDYES:
if (CheckAndSave()==-1) break;
case IDNO:
cListBox.Clear();
vMealItems.clear();
strcpy(cSaveName, "");
cWindow.SetTitle("MealTrack - Untitled");
cButton.SetText("Start Meal");
break;
case IDCANCEL:
default:
break;
}
} else {
cListBox.Clear();
vMealItems.clear();
strcpy(cSaveName, "");
cWindow.SetTitle("MealTrack - Untitled");
cButton.SetText("Start Meal");
}
break;
case ID_FILE_SAVE:
GetSaveFile(hWnd);
if (vMealItems.size() >= 1) CheckAndSave();
char tmp[313];
sprintf(tmp, "MealTrack - %s", strrchr(cSaveName,'\\') + 1);
cWindow.SetTitle(tmp);
break;
case ID_FILE_EXIT:
PostMessage(hWnd, WM_CLOSE, 0, 0);
break;
case ID_SCALE_ZERO:
if (scale != NULL) scale->Zero();
break;
}
}
示例4: ScaleConnect
void ScaleConnect(void* args) {
//If we aren't connected, connect!
if (scale == NULL) {
//Create a new scale and attempt to connect
scale = new Scale("COM1");
if (!scale->IsConnected()) {
delete scale;
scale = new Scale();
}
if (!scale->IsConnected()) {
char err[256];
sprintf(err, "Failed to connect! ERROR: %i", scale->GetError());
mScale.EditItem(ID_SCALE_CONNECT, "&Connect");
cEditBox.SetText(err);
delete scale;
scale = NULL;
return;
}
//Begin the thread which sends a message to the Window's event and loops it
hScaleThread = (HANDLE)_beginthread(GetScaleReading, 0, args);
//Switch the menu to allow for disconnect & other features
SendMessage((HWND)args, WM_SCALE_CONNECTED, 0, 0);
} else {
//Deactivate the meal
bMealActive = 0;
//Delete the scale which will disconnect it
delete scale;
scale = NULL;
SendMessage((HWND)args, WM_SCALE_DISCONNECTED, 0, 0);
}
}