void
FormWindow::CreateDefCombo(CtrlDef& def)
{
	ComboBox* ctrl = CreateComboBox(def.GetText(),
	def.GetX(),
	def.GetY(),
	def.GetW(),
	def.GetH(),
	def.GetID(),
	def.GetParentID());

	ctrl->SetAltText(def.GetAltText());
	ctrl->SetEnabled(def.IsEnabled());
	ctrl->SetBackColor(def.GetBackColor());
	ctrl->SetForeColor(def.GetForeColor());
	ctrl->SetTextAlign(def.GetTextAlign());

	ctrl->SetActiveColor(def.GetActiveColor());
	ctrl->SetBorderColor(def.GetBorderColor());
	ctrl->SetBorder(def.GetBorder());
	ctrl->SetBevelWidth(def.GetBevelWidth());
	ctrl->SetTransparent(def.GetTransparent());
	ctrl->SetHidePartial(def.GetHidePartial());

	ctrl->SetMargins(def.GetMargins());
	ctrl->SetTextInsets(def.GetTextInsets());
	ctrl->SetCellInsets(def.GetCellInsets());
	ctrl->SetCells(def.GetCells());
	ctrl->SetFixedWidth(def.GetFixedWidth());
	ctrl->SetFixedHeight(def.GetFixedHeight());

	int nitems = def.NumItems();
	for (int i = 0; i < nitems; i++)
	ctrl->AddItem(def.GetItem(i));

	Font* f = FontMgr::Find(def.GetFont());
	if (f) ctrl->SetFont(f);
}
Пример #2
0
//-----------------------------------------------------------------------------
// Purpose: sets up the current control to edit
//-----------------------------------------------------------------------------
void BuildModeDialog::SetActiveControl(Panel *controlToEdit)
{	
	if (m_pCurrentPanel == controlToEdit)
	{
		// it's already set, so just update the property data and quit
		if (m_pCurrentPanel)
		{
			UpdateControlData(m_pCurrentPanel);
		}
		return;
	}

	// reset the data
	m_pCurrentPanel = controlToEdit;
	RemoveAllControls();
	m_pPanelList->m_pControls->MoveScrollBarToTop();

	if (!m_pCurrentPanel)
	{
		m_pStatusLabel->SetText("[nothing currently selected]");
		m_pStatusLabel->SetTextColorState(Label::CS_DULL);
		RemoveAllControls();
		return;
	}

	// get the control description string
	const char *controlDesc = m_pCurrentPanel->GetDescription();

	// parse out the control description
	int tabPosition = 1;
	while (1)
	{
		const char *dataType = ParseTokenFromString(&controlDesc);

		// finish when we have no more tokens
		if (*dataType == 0)
			break;

		// default the data type to a string
		int datat = TYPE_STRING;

		if (!stricmp(dataType, "int"))
		{
			datat = TYPE_STRING; //!! just for now
		}
		else if (!stricmp(dataType, "alignment"))
		{
			datat = TYPE_ALIGNMENT;
		}
		else if (!stricmp(dataType, "autoresize"))
		{
			datat = TYPE_AUTORESIZE;
		}
		else if (!stricmp(dataType, "corner"))
		{
			datat = TYPE_CORNER;
		}
		else if (!stricmp(dataType, "localize"))
		{
			datat = TYPE_LOCALIZEDSTRING;
		}

		// get the field name
		const char *fieldName = ParseTokenFromString(&controlDesc);

		int itemHeight = 18;

		// build a control & label
		Label *label = new Label(this, NULL, fieldName);
		label->SetSize(96, itemHeight);
		label->SetContentAlignment(Label::a_east);

		TextEntry *edit = NULL;
		ComboBox *editCombo = NULL;
		Button *editButton = NULL;
		if (datat == TYPE_ALIGNMENT)
		{
			// drop-down combo box
			editCombo = new ComboBox(this, NULL, 9, false);
			editCombo->AddItem("north-west", NULL);
			editCombo->AddItem("north", NULL);
			editCombo->AddItem("north-east", NULL);
			editCombo->AddItem("west", NULL);
			editCombo->AddItem("center", NULL);
			editCombo->AddItem("east", NULL);
			editCombo->AddItem("south-west", NULL);
			editCombo->AddItem("south", NULL);
			editCombo->AddItem("south-east", NULL);
		
			edit = editCombo;
		}
		else if (datat == TYPE_AUTORESIZE)
		{
			// drop-down combo box
			editCombo = new ComboBox(this, NULL, 4, false);
			editCombo->AddItem( "0 - no auto-resize", NULL);
			editCombo->AddItem( "1 - resize right", NULL);
			editCombo->AddItem( "2 - resize down", NULL);
			editCombo->AddItem( "3 - down & right", NULL);
		
			edit = editCombo;
		}
		else if (datat == TYPE_CORNER)
		{
			// drop-down combo box
			editCombo = new ComboBox(this, NULL, 4, false);
			editCombo->AddItem("0 - top-left", NULL);
			editCombo->AddItem("1 - top-right", NULL);
			editCombo->AddItem("2 - bottom-left", NULL);
			editCombo->AddItem("3 - bottom-right", NULL);
		
			edit = editCombo;
		}
		else if (datat == TYPE_LOCALIZEDSTRING)
		{
			editButton = new Button(this, NULL, "...");
			editButton->SetParent(this);
			editButton->AddActionSignalTarget(this);
			editButton->SetTabPosition(tabPosition++);
			editButton->SetTall( itemHeight );
			label->SetAssociatedControl(editButton);
		}
		else
		{
			// normal string edit
			edit = new CSmallTextEntry(this, NULL);
		}

		if (edit)
		{
			edit->SetTall( itemHeight );
			edit->SetParent(this);
			edit->AddActionSignalTarget(this);
			edit->SetTabPosition(tabPosition++);
			label->SetAssociatedControl(edit);
		}

		HFont smallFont = scheme()->GetIScheme( GetScheme() )->GetFont( "DefaultVerySmall" );

		if ( label )
		{
			label->SetFont( smallFont );
		}
		if ( edit )
		{
			edit->SetFont( smallFont );
		}
		if ( editCombo )
		{
			editCombo->SetFont( smallFont );
		}
		if ( editButton )
		{
			editButton->SetFont( smallFont );
		}

		// add to our control list
		m_pPanelList->AddItem(label, edit, editCombo, editButton, fieldName, datat);

		if ( edit )
		{
			m_pPanelList->m_pControls->AddItem(label, edit);
		}
		else
		{
			m_pPanelList->m_pControls->AddItem(label, editButton);
		}
	}

	// check and see if the current panel is a Label
	// iterate through the class hierarchy 
	if ( controlToEdit->IsBuildModeDeletable() )
	{
		m_pDeleteButton->SetEnabled(true);
	}
	else
	{
		m_pDeleteButton->SetEnabled(false);	
	}

	// update the property data in the dialog
	UpdateControlData(m_pCurrentPanel);
	
	// set our title
	if ( m_pBuildGroup->GetResourceName() )
	{
		m_pFileSelectionCombo->SetText(m_pBuildGroup->GetResourceName());
	}
	else
	{
		m_pFileSelectionCombo->SetText("[ no resource file associated with dialog ]");
	}

	m_pApplyButton->SetEnabled(false);
	InvalidateLayout();
	Repaint();
}
//-----------------------------------------------------------------------------
// Purpose: Creates all the controls in the game options list
//-----------------------------------------------------------------------------
void CCreateMultiplayerGameGameplayPage::LoadGameOptionsList()
{
	// destroy any existing controls
	mpcontrol_t *p, *n;

	p = m_pList;
	while ( p )
	{
		n = p->next;
		//
		delete p->pControl;
		delete p->pPrompt;
		delete p;
		p = n;
	}

	m_pList = NULL;


	// Go through desciption creating controls
	CScriptObject *pObj;

	pObj = m_pDescription->pObjList;

	mpcontrol_t	*pCtrl;

	CheckButton *pBox;
	TextEntry *pEdit;
	ComboBox *pCombo;
	CScriptListItem *pListItem;

	Panel *objParent = m_pOptionsList;

	while ( pObj )
	{
		pCtrl = new mpcontrol_t( objParent, "mpcontrol_t" );
		pCtrl->type = pObj->type;

		switch ( pCtrl->type )
		{
		case O_BOOL:
			pBox = new CheckButton( pCtrl, "DescCheckButton", pObj->prompt );
			pBox->SetSelected( pObj->fdefValue != 0.0f ? true : false );
			
			pCtrl->pControl = (Panel *)pBox;
			break;
		case O_STRING:
		case O_NUMBER:
			pEdit = new TextEntry( pCtrl, "DescTextEntry");
			pEdit->InsertString(pObj->defValue);
			pCtrl->pControl = (Panel *)pEdit;
			break;
		case O_LIST:
			pCombo = new ComboBox( pCtrl, "DescComboBox", 5, false );

			pListItem = pObj->pListItems;
			while ( pListItem )
			{
				pCombo->AddItem(pListItem->szItemText, NULL);
				pListItem = pListItem->pNext;
			}

			pCombo->ActivateItemByRow((int)pObj->fdefValue);

			pCtrl->pControl = (Panel *)pCombo;
			break;
		default:
			break;
		}

		if ( pCtrl->type != O_BOOL )
		{
			pCtrl->pPrompt = new vgui::Label( pCtrl, "DescLabel", "" );
			pCtrl->pPrompt->SetContentAlignment( vgui::Label::a_west );
			pCtrl->pPrompt->SetTextInset( 5, 0 );
			pCtrl->pPrompt->SetText( pObj->prompt );
		}

		pCtrl->pScrObj = pObj;
		pCtrl->SetSize( 100, 28 );
		//pCtrl->SetBorder( scheme()->GetBorder(1, "DepressedButtonBorder") );
		m_pOptionsList->AddItem( pCtrl );

		// Link it in
		if ( !m_pList )
		{
			m_pList = pCtrl;
			pCtrl->next = NULL;
		}
		else
		{
			mpcontrol_t *p;
			p = m_pList;
			while ( p )
			{
				if ( !p->next )
				{
					p->next = pCtrl;
					pCtrl->next = NULL;
					break;
				}
				p = p->next;
			}
		}

		pObj = pObj->pNext;
	}
}
Пример #4
0
void CGECreateServer::PopulateControls( void )
{
	// Only populate on first load
	if ( !m_bFirstLoad )
		return;

	// Populate the map list
	ComboBox *maplist = dynamic_cast<ComboBox*>( FindChildByName("MapList") );
	if ( maplist )
	{
		// Clear the list first
		maplist->DeleteAllItems();
		
		FileFindHandle_t findHandle; // note: FileFINDHandle
		char file[32];

		maplist->AddItem( "#SERVER_RANDOM_MAP", new KeyValues(RANDOM_VALUE) );
		const char *pFilename = filesystem->FindFirstEx( "maps\\*.bsp", "MOD", &findHandle );
		while ( pFilename )
		{
			if ( stricmp(pFilename, "ge_transition.bsp") ) //They don't need to pick our dinky crash avoidance map.
			{
				// Add the map to the list
				Q_FileBase(pFilename, file, 32);
				maplist->AddItem(file, new KeyValues(file));
			}

			pFilename = filesystem->FindNext( findHandle );
		}

		filesystem->FindClose( findHandle );
		maplist->SetNumberOfEditLines( 10 );
		maplist->SetEditable( false );
		maplist->GetMenu()->ForceCalculateWidth();
		maplist->ActivateItemByRow( 0 );
	}

	// Populate the weapon list
	ComboBox *weaponlist = dynamic_cast<ComboBox*>( FindChildByName("WeaponList") );
	if ( weaponlist )
	{
		weaponlist->DeleteAllItems();

		// TAKEN DIRECTLY FROM ge_loadoutmanager.cpp
		// Parsing individually allows us to overwrite the default sets with custom ones
		// Multiple custom sets can be defined as needed (can even make sets per gameplay)
		if ( !GELoadoutParser.HasBeenParsed() )
		{
			GELoadoutParser.InitParser("scripts/loadouts/weapon_sets_default.X");
			GELoadoutParser.SetHasBeenParsed( false );
			GELoadoutParser.InitParser("scripts/loadouts/weapon_sets_custom*.X");
		}

		// Random loadout
		weaponlist->AddItem( "#SERVER_RANDOM_SET", new KeyValues("random_loadout") );
	
		FOR_EACH_DICT( m_WeaponSets, idx )
		{
			if (Q_strstr(m_WeaponSets.GetElementName(idx), "_mhide"))
				continue;

			int id = weaponlist->AddItem( m_WeaponSets.GetElementName(idx), NULL );
			weaponlist->GetMenu()->SetItemEnabled( id, false );

			for ( int k=m_WeaponSets[idx]->First(); k != m_WeaponSets[idx]->InvalidIndex(); k = m_WeaponSets[idx]->Next(k) )
				weaponlist->AddItem( m_WeaponSets[idx]->Element(k), new KeyValues(m_WeaponSets[idx]->GetElementName(k)) );
		}

		weaponlist->SetEditable( false );
		weaponlist->SetNumberOfEditLines( 15 );
		weaponlist->GetMenu()->ForceCalculateWidth();
		weaponlist->ActivateItemByRow( 0 );
	}

	// Populate the scenario list
	ComboBox *scenariolist = dynamic_cast<ComboBox*>( FindChildByName("ScenarioList") );
	if ( scenariolist )
	{
		// Clear the list first
		scenariolist->DeleteAllItems();

		FileFindHandle_t findHandle; // note: FileFINDHandle
		char file[32];

		scenariolist->AddItem( "#SERVER_RANDOM_SCENARIO", new KeyValues(RANDOM_VALUE) );
		const char *pFilename = filesystem->FindFirstEx( PYDIR, "MOD", &findHandle );
		while ( pFilename )
		{
			// Add the scenario to the list if not __init__
			if ( !Q_stristr( pFilename, "__init__") )
			{
				Q_FileBase( pFilename, file, 32 );
				scenariolist->AddItem( file, new KeyValues(file) );
			}

			pFilename = filesystem->FindNext( findHandle );
		}

		filesystem->FindClose( findHandle );
		scenariolist->SetEditable( false );
		scenariolist->SetNumberOfEditLines( 10 );
		scenariolist->GetMenu()->ForceCalculateWidth();
		scenariolist->ActivateItemByRow( 0 );
	}

	// Populate the bot difficulty list
	ComboBox *botdifflist = dynamic_cast<ComboBox*>( FindChildByName("BotLevel") );
	if ( botdifflist && botdifflist->GetItemCount() == 0 )
	{
		// Hard coded items (sorry!)
		botdifflist->AddItem( "#BOT_LEVEL_EASY", new KeyValues("1") );
		botdifflist->AddItem( "#BOT_LEVEL_MED", new KeyValues("3") );
		botdifflist->AddItem( "#BOT_LEVEL_HARD", new KeyValues("6") );
		botdifflist->AddItem( "#BOT_LEVEL_UBER", new KeyValues("9") );

		// Admin
		botdifflist->SetEditable( false );
		botdifflist->SetNumberOfEditLines( 4 );
		botdifflist->GetMenu()->ForceCalculateWidth();
		botdifflist->ActivateItemByRow( 0 );
	}

	// Populate the turbo mode list
	ComboBox *turbolist = dynamic_cast<ComboBox*>( FindChildByName("TurboMode") );
	if ( turbolist && turbolist->GetItemCount() == 0 )
	{
		// Hard coded items (sorry!)
		turbolist->AddItem( "#TURBO_MODE_NORM", new KeyValues("1.000000") );
		turbolist->AddItem( "#TURBO_MODE_FAST", new KeyValues("1.500000") );
		turbolist->AddItem( "#TURBO_MODE_LIGHT", new KeyValues("1.850000") );
		
		// Admin
		turbolist->SetEditable( false );
		turbolist->SetNumberOfEditLines( 3 );
		turbolist->GetMenu()->ForceCalculateWidth();
		turbolist->ActivateItemByRow( 0 );
	}

	// Load the default/saved values from our command map
	for ( KeyValues *kv = m_kvCmdMap->GetFirstTrueSubKey(); kv; kv = kv->GetNextTrueSubKey() )
	{
		// Get our value (or default)
		const char *value = (m_kvCmdValues->FindKey( kv->GetName() )) ? m_kvCmdValues->GetString( kv->GetName() ) : NULL;
		if ( !value )
			value = kv->GetString( "default", "" );

		if ( !Q_stricmp(kv->GetString("type"), "CHOICE") )
		{
			ComboBox *panel = dynamic_cast<ComboBox*>( FindChildByName(kv->GetName()) );
			if ( !panel )
				continue;

			// Search through all our items to find a matching value
			for ( int i=0; i < panel->GetItemCount(); i++ )
			{
				int id = panel->GetItemIDFromRow( i );
				KeyValues* userdata = panel->GetItemUserData( id );
				
				if ( userdata && !Q_stricmp(value, userdata->GetName()) )
				{
					panel->ActivateItem( id );
					break;
				}
			}
		}
		else if ( !Q_stricmp(kv->GetString("type"), "TEXT") )
		{
			TextEntry *panel = dynamic_cast<TextEntry*>( FindChildByName(kv->GetName()) );
			if ( !panel )
				continue;

			panel->SetText( value );
		}
		else if ( !Q_stricmp(kv->GetString("type"), "BOOL") )
		{
			CheckButton *panel = dynamic_cast<CheckButton*>( FindChildByName(kv->GetName()) );
			if ( !panel )
				continue;

			if ( !Q_stricmp(value, "1") )
				panel->SetSelected( true );
			else
				panel->SetSelected( false );
		}
	}

	m_bFirstLoad = false;
}
Пример #5
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFOptionsAdvancedPanel::CreateControls()
{
	BaseClass::CreateControls();

	// Go through desciption creating controls
	CScriptObject *pObj;
	pObj = m_pDescription->pObjList;
	
	mpcontrol_t	*pCtrl;
	CTFAdvCheckButton *pBox;
	TextEntry *pEdit;
	ComboBox *pCombo;
	CTFAdvSlider *pScroll;
	CTFAdvButton *pTitle;
	CScriptListItem *pListItem;
	

	Panel *objParent = m_pListPanel;
	while (pObj)
	{
		//Msg("\nAdded: %s %s %f %f %i\n", pObj->prompt, pObj->cvarname, pObj->fcurValue, pObj->fdefValue, pObj->type);
		
		if (pObj->type == O_OBSOLETE)
		{
			pObj = pObj->pNext;
			continue;
		}

		pCtrl = new mpcontrol_t(objParent, "mpcontrol_t");
		pCtrl->type = pObj->type;

	
		switch (pCtrl->type)
		{
		case O_BOOL:
			pBox = new CTFAdvCheckButton(pCtrl, "DescCheckButton", pObj->prompt);
			pBox->SetSelected(pObj->fdefValue != 0.0f ? true : false);
			pBox->SetCommandString(pObj->cvarname);
			pBox->GetButton()->SetFontByString(m_pListPanel->GetFontString());
			if (pObj->tooltip[0] != '\0')
			{
				wchar_t *pText = g_pVGuiLocalize->Find(pObj->tooltip);
				if (pText != NULL)
				{
					char pszToolTipLocal[256];
					wcstombs(pszToolTipLocal, pText, sizeof(pszToolTipLocal));
					pBox->SetToolTip(pszToolTipLocal);
				}
				else
				{
					pBox->SetToolTip(pObj->tooltip);
				}
			}
			pCtrl->pControl = (Panel *)pBox;
			break;
		case O_STRING:
		case O_NUMBER:
			pEdit = new TextEntry(pCtrl, "DescTextEntry");
			pEdit->InsertString(pObj->defValue);
			pCtrl->pControl = (Panel *)pEdit;
			break;
		case O_SLIDER:
			pScroll = new CTFAdvSlider(pCtrl, "DescScrollEntry", pObj->prompt);
			pScroll->SetValue(pObj->fdefValue);
			pScroll->SetCommandString(pObj->cvarname);
			pScroll->SetMinMax(pObj->fMin, pObj->fMax);
			pScroll->GetButton()->SetFontByString(m_pListPanel->GetFontString());
			pCtrl->pControl = (Panel *)pScroll;
			break;
		case O_LIST:
			pCombo = new ComboBox(pCtrl, "DescComboBox", 5, false);

			pListItem = pObj->pListItems;
			while (pListItem)
			{
				pCombo->AddItem(pListItem->szItemText, NULL);
				pListItem = pListItem->pNext;
			}

			pCombo->ActivateItemByRow((int)pObj->fdefValue);

			pCtrl->pControl = (Panel *)pCombo;
			break;
		case O_CATEGORY:
			pTitle = new CTFAdvButton(pCtrl, "DescTextTitle", pObj->prompt);
			pTitle->SetEnabled(false);
			pTitle->SetBorderByString("AdvSettingsTitleBorder");
			pTitle->SetBorderVisible(true);
			pTitle->GetButton()->SetFontByString("MenuSmallFont");
			pCtrl->pControl = (Panel *)pTitle;
			break;
		default:
			break;
		}

		if (pCtrl->type != O_BOOL && pCtrl->type != O_SLIDER && pCtrl->type != O_CATEGORY)
		{
			pCtrl->pPrompt = new vgui::Label(pCtrl, "DescLabel", "");
			pCtrl->pPrompt->SetFont(m_pListPanel->GetFont());
			pCtrl->pPrompt->SetContentAlignment(vgui::Label::a_west);
			pCtrl->pPrompt->SetTextInset(5, 0);
			pCtrl->pPrompt->SetText(pObj->prompt);
		}

		pCtrl->pScrObj = pObj;
		int h = m_pListPanel->GetTall() / 13.0; //(float)GetParent()->GetTall() / 15.0;
		pCtrl->SetSize(800, h);
		//pCtrl->SetBorder( scheme()->GetBorder(1, "DepressedButtonBorder") );
		m_pListPanel->AddItem(pCtrl);

		// Link it in
		if (!m_pList)
		{
			m_pList = pCtrl;
			pCtrl->next = NULL;
		}
		else
		{
			mpcontrol_t *p;
			p = m_pList;
			while (p)
			{
				if (!p->next)
				{
					p->next = pCtrl;
					pCtrl->next = NULL;
					break;
				}
				p = p->next;
			}
		}
		
		pObj = pObj->pNext;
	}
}
Пример #6
0
//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;
}