// -----------------------------------------------------------------------
// Properties form init
void CALLBACK FrmUserDiagPropsInitProc(HWND hWnd)
{
    HDC ProphDC = 0;
    SIZE PropSize;
    HGDIOBJ OldPropObject = 0;
    char *Property_Name;
    int i = 0;

    hPropListbox = CreateListBox(1, 20, ControlWidth(hWnd) - 1, ControlHeight(hWnd) - 20, hWnd, 0, &PropListboxHook, 0,
                                 LBS_USETABSTOPS | LBS_OWNERDRAWFIXED | WS_VSCROLL, WS_EX_STATICEDGE);
    hPropCombobox = CreateComboBox(0, 0, ControlWidth(hWnd), 150, hWnd, "", 1, 0, CBS_DROPDOWNLIST | WS_TABSTOP);
    ComboBoxAddItem(hPropCombobox, DialogName + (CStr) " - " + (CStr) "Dialog", -1);
    ComboBoxSetIndex(hPropCombobox, 0);
    FillPropertiesListbox(PROPDIAG_NBRPROPS);
    ProphDC = GetDC(hWnd);
    OldPropObject = SelectObject(ProphDC, WASerifFont);
    MaxPropXSize = 0;
    // Get largest property size
    for(i = 0; i < GetObjectDatas(hCurrentObject, OBJECT_PROPNBR); i++)
    {
        Property_Name = (char *) GetPropertyDatas(hCurrentObject, i, PROPERTY_NAME);
        GetTextExtentPoint32(ProphDC, Property_Name, strlen(Property_Name), &PropSize);
        if(PropSize.cx > MaxPropXSize) MaxPropXSize = PropSize.cx;
    }
    MaxPropXSize = MaxPropXSize + 10;
    SelectObject(ProphDC, OldPropObject);
    ReleaseDC(hWnd, ProphDC);
    ListBoxSetColumnsWidth(hPropListbox, MaxPropXSize);
    ListBoxSetIndex(hPropListbox, 0);
    ListBoxSetTopIndex(hPropListbox, 0);
    // Get the icons
    hPropComboPoints = LoadImage(ApphInstance, MAKEINTRESOURCE(ICON_RES_TOOL_BASE + ICON_RES_TOOL_COMBOPOINTS), IMAGE_ICON, 0, 0, 0);
}
//------------------------------------------------------------------------
//! Overrides OnEditBegin() to provide a CComboBox cell value editor
//!
//! @param owner The list control starting edit
//! @param nRow The index of the row for the cell to edit
//! @param nCol The index of the column for the cell to edit
//! @param pt The position clicked, in client coordinates.
//! @return Pointer to the cell editor to use (NULL if cell edit is not possible)
//------------------------------------------------------------------------
CWnd* CGridColumnTraitCombo::OnEditBegin(CGridListCtrlEx& owner, int nRow, int nCol, CPoint pt)
{
	// Check if the user clicked the cell icon (or the label-column checkbox)
	CRect labelRect;
	if (owner.GetCellRect(nRow, nCol, LVIR_LABEL, labelRect) && !labelRect.PtInRect(pt))
		return CGridColumnTraitImage::OnEditBegin(owner, nRow, nCol, pt);

	// Get position of the cell to edit
	CRect rectCell = GetCellEditRect(owner, nRow, nCol);

	// Create edit control to edit the cell
	//	- Stores the pointer, so elements can be dynamically added later
	m_pComboBox = CreateComboBox(owner, nRow, nCol, rectCell);
	VERIFY(m_pComboBox!=NULL);

	// Add all items to list
	if (m_ComboList.GetSize()>0)
	{
		LoadList(m_ComboList, -1);

		// Guess the currently selected item in the list
		CString item = owner.GetItemText(nRow, nCol);
		int nCurSel = m_pComboBox->FindString(-1, item);
		if (nCurSel!=-1)
			m_pComboBox->SetCurSel(nCurSel);
		else
			m_pComboBox->SetWindowText(item);
	}
	else
	{
		CString item = owner.GetItemText(nRow, nCol);
		m_pComboBox->SetWindowText(item);
	}

	// Adjust the item-height to font-height (Must be done after resizing)
	CRect rectCombo;
	m_pComboBox->GetClientRect(&rectCombo);
	if (rectCombo.Height() < rectCell.Height())
	{
		// Expand to fit cell
		int padding = rectCell.Height() - rectCombo.Height();
		m_pComboBox->SetItemHeight(-1, m_pComboBox->GetItemHeight(-1)+padding);
	}
	else
	if (rectCombo.Height() > rectCell.Height() + ::GetSystemMetrics(SM_CXBORDER))
	{
		// Compress to fit cell
		int margin = rectCombo.Height() - m_pComboBox->GetItemHeight(-1);
		int padding = margin - 2*::GetSystemMetrics(SM_CXEDGE);
		if ((m_pComboBox->GetStyle() & CBS_DROPDOWNLIST) == CBS_DROPDOWNLIST)
			padding -= ::GetSystemMetrics(SM_CXEDGE);
		if (padding > 0)
			m_pComboBox->SetItemHeight(-1, m_pComboBox->GetItemHeight(-1)-padding);
	}
	return m_pComboBox;
}
void Explorerplusplus::CreateAddressBar(void)
{
	m_hAddressBar = CreateComboBox(m_hMainRebar,WS_CHILD|WS_VISIBLE|WS_TABSTOP|
		CBS_DROPDOWN|CBS_AUTOHSCROLL|WS_CLIPSIBLINGS|WS_CLIPCHILDREN);

	HIMAGELIST SmallIcons;
	Shell_GetImageLists(NULL,&SmallIcons);
	SendMessage(m_hAddressBar,CBEM_SETIMAGELIST,0,reinterpret_cast<LPARAM>(SmallIcons));

	HWND hEdit = reinterpret_cast<HWND>(SendMessage(m_hAddressBar,CBEM_GETEDITCONTROL,0,0));
	SetWindowSubclass(hEdit,EditSubclassStub,0,reinterpret_cast<DWORD_PTR>(this));

	/* Turn on auto complete for the edit control within the combobox.
	This will let the os complete paths as they are typed. */
	SHAutoComplete(hEdit,SHACF_FILESYSTEM|SHACF_AUTOSUGGEST_FORCE_ON);
}
CLuaCFGMenu::CLuaCFGMenu(const char *desc) : CBaseLuaWidget(desc), m_bInitSelection(true)
{
    GtkWidget *vbox = gtk_vbox_new(FALSE, 10);
    gtk_widget_show(vbox);
    gtk_container_add(GTK_CONTAINER(GetBox()), vbox);
    
    GtkWidget *varbox = CreateVarListBox();
    gtk_container_add(GTK_CONTAINER(vbox), varbox);
    
    m_pInputField = CreateInputField();
    gtk_box_pack_start(GTK_BOX(vbox), m_pInputField, TRUE, TRUE, 10);
    
    m_pComboBox = CreateComboBox();
    gtk_box_pack_start(GTK_BOX(vbox), m_pComboBox, TRUE, TRUE, 10);
    
    m_pDirInputBox = CreateDirSelector();
    gtk_box_pack_start(GTK_BOX(vbox), m_pDirInputBox, TRUE, TRUE, 10);
}
int	CColListCtrl::ShowItemComboBox( int nItem )
{
	// Hide and Save Old
	HideItemComboBox( );

	m_nCurItem	=	nItem;
	// Valid
	if( nItem < 0 || m_nComboBoxColumn < 0 )
		return	-1;

	// Create and Show
	if( CreateComboBox( nItem ) )
	{
		CRect rect;
		GetSubItemRect( nItem, m_nComboBoxColumn, LVIR_BOUNDS, rect );
		m_comboBox.SetWindowPos( NULL, rect.left, rect.top+1, rect.Width(), rect.Height()-1, SWP_SHOWWINDOW );
		m_comboBox.SetFocus();
		m_comboBox.SelectString( 0, GetItemText( nItem, m_nComboBoxColumn ) );
		m_comboBox.ShowDropDown( TRUE );
	}
	return	0;
}
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);
}
Esempio n. 7
0
// -----------------------------------------------------------------------
// Initialize Form
int CALLBACK FRMPrjPropsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT CreatePs;
    CStr BufString;

    switch(uMsg)
    {
        case WM_INITDIALOG:
            FRMPrjPropshWnd = hwndDlg;
            ControlSetText(hwndDlg, "Project properties");
            FRMPrjPropsFr1 = CreateFrame(2, -1, 202, 108, hwndDlg, "Application", 0, 0, 0);
            FRMPrjPropsFr2 = CreateFrame(206, -1, 194, 108, hwndDlg, "Version", 0, 0, 0);
            FRMPrjPropsFr3 = CreateFrame(2, 108, 398, 94, hwndDlg, "Version informations", 14, &FRMPrjPropsFrame3, 0);
            CreateLabel(5, 21 + 20, 35, 15, FRMPrjPropsFr1, "Title :", 0, 0, 0, 0);
            CreateLabel(5, 41 + 25, 52, 15, FRMPrjPropsFr1, "File type :", 0, 0, 0, 0);
            CreateLabel(131, 41 + 25, 34, 15, FRMPrjPropsFr1, "Icon :", 0, 0, 0, 0);
            FRMPrjPropsOk = CreateButton(243, 214, 77, 23, hwndDlg, "Ok", 1, 0, 0, 0, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsCancel = CreateButton(322, 214, 77, 23, hwndDlg, "Cancel", 2, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsReg = CreateButton(159, 214, 77, 23, hwndDlg, "Register", 3, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsConstants = CreateButton(3, 214, 77, 23, hwndDlg, "Constants", 4, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsIncludeVersion = CreateCheckBox(7, 18, 140, 15, FRMPrjPropsFr1, "Include version resource", 5, 0, WS_TABSTOP | WS_GROUP, 0);
            FRMPrjPropsTxtTitle = CreateTextBox(36, 18 + 20, 159, 20, FRMPrjPropsFr1, "", 6, 0, WS_TABSTOP | ES_AUTOHSCROLL, WS_EX_STATICEDGE);
            FRMPrjPropsFileType = CreateComboBox(5, 56 + 25, 123, 150, FRMPrjPropsFr1, "", 7, 0, CBS_DROPDOWNLIST | WS_TABSTOP);
            ComboBoxAddItem(FRMPrjPropsFileType, "UNKNOWN", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "APP", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "DLL", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "DRV", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "FONT", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "VXD", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "STATIC_LIB", -1);
            ComboBoxSetIndex(FRMPrjPropsFileType, 0);
            FRMPrjPropsSetIcon = CreateButton(133, 56 + 25, 25, 21, hwndDlg, "...", 8, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            // Current icon
            if(ProjectTypeScheduledImg.Len()) BufString = ProjectTypeScheduledImg;
            else BufString = ProjectDir + (CStr) "\\" + (CStr) ProjectTypeImg;
            FRMPrjPropsIconhandle = LoadImage(0, BufString.Get_String(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
            FRMPrjPropsIcon = CreatePictureBox(163, 43 + 25, 35, 34, FRMPrjPropsFr1, FRMPrjPropsIconhandle, IMAGE_ICON, 9, 0, SS_CENTERIMAGE);
            CreateLabel(7, 15, 52, 13, FRMPrjPropsFr2, "Major :", 0, 0, 0, 0);
            CreateLabel(99, 15, 52, 13, FRMPrjPropsFr2, "Minor :", 0, 0, 0, 0);
            CreateLabel(7, 35, 52, 13, FRMPrjPropsFr2, "Revision :", 0, 0, 0, 0);
            CreateLabel(99, 35, 52, 13, FRMPrjPropsFr2, "Release :", 0, 0, 0, 0);
            FRMPrjPropsTxtMajor = CreateTextBox(59, 12, 33, 20, FRMPrjPropsFr2, "", 10, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            FRMPrjPropsTxtMinor = CreateTextBox(151, 12, 33, 20, FRMPrjPropsFr2, "", 11, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            FRMPrjPropsTxtRevision = CreateTextBox(59, 32, 33, 20, FRMPrjPropsFr2, "", 12, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            FRMPrjPropsTxtRelease = CreateTextBox(151, 32, 33, 20, FRMPrjPropsFr2, "", 13, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            CreateLabel(7, 61, 31, 15, FRMPrjPropsFr2, "OS :", 0, 0, 0, 0);
            FRMPrjPropsOS = CreateComboBox(34, 57, 150, 150, FRMPrjPropsFr2, "", 14, 0, CBS_DROPDOWNLIST | WS_TABSTOP);
            ComboBoxAddItem(FRMPrjPropsOS, "UNKNOWN", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "DOS", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "NT", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "WINDOWS16", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "WINDOWS32", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "DOS_WINDOWS16", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "DOS_WINDOWS32", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "NT_WINDOWS32", -1);
            ComboBoxSetIndex(FRMPrjPropsOS, 0);
            FRMPrjPropsIncludeXPManifest = CreateCheckBox(16, 85, 170, 15, FRMPrjPropsFr2, "Include Windows XP manifest", 15, 0, WS_TABSTOP | WS_GROUP, 0);
            CreateLabel(5, 16, 52, 13, FRMPrjPropsFr3, "Type :", 0, 0, 0, 0);
            FRMPrjPropsTypeProp = CreateListBox(5, 30, 140, 59, FRMPrjPropsFr3, 16, 0, 0, WS_TABSTOP | WS_HSCROLL, WS_EX_STATICEDGE);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Comments", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Company name", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "File description", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Legal copyright", -1);
            ListBoxAddItem( FRMPrjPropsTypeProp, "Legal trademarks", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Product name", -1);
            ListBoxSetIndex(FRMPrjPropsTypeProp, 0);
            FRMPrjPropsTypeTxt = CreateTextBox(147, 13 - 2, 245, 79, FRMPrjPropsFr3, "", 17, &FRMPrjPropsTypeTxtHook, WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | ES_WANTRETURN, WS_EX_STATICEDGE);
            LoadUserInfos();
            ControlSetText(FRMPrjPropsTxtMajor, Prj_Major);
            ControlSetText(FRMPrjPropsTxtMinor, Prj_Minor);
            ControlSetText(FRMPrjPropsTxtRevision, Prj_Revision);
            ControlSetText(FRMPrjPropsTxtRelease, Prj_Release);
            CheckBoxSetState(FRMPrjPropsIncludeVersion, Prj_IncludeVersion);
            CheckBoxSetState(FRMPrjPropsIncludeXPManifest, Prj_IncludeManifest);
            ComboBoxSetIndex(FRMPrjPropsOS, Prj_OS);
            ComboBoxSetIndex(FRMPrjPropsFileType, Prj_FileType);
            ControlSetText(FRMPrjPropsTxtTitle, ProjectTitle);
            TmpPrj_Comments = Prj_Comments;
            if(Prj_CompanyName.Len()) TmpPrj_CompanyName = Prj_CompanyName;
            TmpPrj_FileDescription = Prj_FileDescription;
            if(Prj_LegalCopyRight.Len()) TmpPrj_LegalCopyRight = Prj_LegalCopyRight;
            if(Prj_LegalTrademarks.Len()) TmpPrj_LegalTrademarks = Prj_LegalTrademarks;
            TmpPrj_ProductName = Prj_ProductName;
            ControlSetText(FRMPrjPropsTypeTxt, TmpPrj_Comments);
            FreezeTimer = 1;
            return(1);
        case WM_COMMAND:
            if((HWND) lParam == FRMPrjPropsOk)
            {
                ProjectTypeScheduledImg = NewIconFile;
                SaveProjectProperties();
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsCancel)
            {
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsConstants)
            {
                CreateConstants(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsReg)
            {
                RegisterUserInfos();
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsSetIcon)
            {
                SetProjectIcon();
                return(0);
            }
            break;
        case WM_PAINT:
            BeginPaint(hwndDlg, &CreatePs);
            GDIDrawHorzSep(hwndDlg, 0, 207, 402);
            EndPaint(hwndDlg, &CreatePs);
            break;
        case WM_CLOSE:
            FreezeTimer = 0;
            EndDialog(hwndDlg, 0);
            break;
    }
    return(0);
}
Esempio n. 8
0
/*------------------------------------------------------------------------------------------------------------------
-- FUNCTION: InitWindow
--
-- DATE: February 9th, 2016
--
-- REVISIONS: February 9th, 2016: Created InitWindow
--			  February 15th, 2016: Commented
--
-- DESIGNER: Carson Roscoe
--
-- PROGRAMMER: Carson Roscoe
--
-- int InitWindow(HINSTANCE hInstance)
--
-- RETURN: int regarding success or fail
--
-- NOTES:
-- Creates the window, assigns UI  and gives them default values.
----------------------------------------------------------------------------------------------------------------------*/
int InitWindow(HINSTANCE hInstance) {
    WNDCLASSEX wcex;

    ////Setup Window////
    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.style = CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc = WndProc;
    wcex.cbClsExtra = 0;
    wcex.cbWndExtra = 0;
    wcex.hInstance = hInstance;
    wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
    wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wcex.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
    wcex.lpszClassName = PROGRAM_TITLE;
    wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));

    if (!RegisterClassEx(&wcex)) {
        DWORD errorCode = GetLastError();
        perror("RegisterClassEx Failed with error " + errorCode);
        return -1;
    }

    hwnd = CreateWindow(PROGRAM_TITLE, PROGRAM_TITLE, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 700, 500, NULL, NULL, hInstance, NULL);

    if (!hwnd) {
        DWORD errorCode = GetLastError();
        perror("CreateWindow Failed with error " + errorCode);
        return -1;
    }

    ////Assign UI////
    labelIP = CreateLabel("IP ", MARGIN, MARGIN, LABELWIDTH, LABELHEIGHT);
    editTextIP = CreateEditText("127.0.0.1", EDITSTART + MARGIN, MARGIN, EDITWIDTH, EDITHEIGHT);
    labelPort = CreateLabel("Port ", MARGIN + LABELWIDTH + SPACING + EDITWIDTH, MARGIN, LABELWIDTH, LABELHEIGHT);
    editTextPort = CreateEditText("7000", LABELWIDTH * 2 + SPACING * 2 + EDITWIDTH, MARGIN, EDITWIDTH, EDITHEIGHT);

    labelPacketSize = CreateLabel("Size ", MARGIN, MARGIN + LABELHEIGHT + SPACING, LABELWIDTH, LABELHEIGHT);
    comboBox1 = CreateComboBox(EDITSTART + MARGIN, MARGIN + LABELHEIGHT + SPACING, EDITWIDTH, COMBOHEIGHT);

    labelQuantity = CreateLabel("Quantity ", MARGIN + LABELWIDTH + SPACING + EDITWIDTH, MARGIN + LABELHEIGHT + SPACING, LABELWIDTH, LABELHEIGHT);
    comboBox2 = CreateComboBox(LABELWIDTH * 2 + SPACING * 2 + EDITWIDTH, MARGIN + LABELHEIGHT + SPACING, EDITWIDTH, COMBOHEIGHT);

    labelProtocol = CreateLabel("Protocol ", MARGIN, MARGIN + LABELHEIGHT * 2 + SPACING * 2, LABELWIDTH, LABELHEIGHT);
    comboBox3 = CreateComboBox(EDITSTART + MARGIN, MARGIN + LABELHEIGHT*2 + SPACING*2, EDITWIDTH, COMBOHEIGHT);

    buttonSend = CreateButton("Send ", MARGIN + LABELWIDTH + SPACING + EDITWIDTH, MARGIN + LABELHEIGHT * 2 + SPACING * 2, LABELWIDTH + EDITWIDTH + SPACING, LABELHEIGHT);

    textBoxResult = CreateTextBox(MARGIN, MARGIN + LABELHEIGHT * 3 + SPACING * 3, MARGIN + LABELWIDTH + SPACING + EDITWIDTH + LABELWIDTH + EDITWIDTH, LABELHEIGHT * 5);

    ////Give UI default values////
    ComboBox_AddString(comboBox1, "1024");
    ComboBox_AddString(comboBox1, "2048");
    ComboBox_AddString(comboBox1, "4096");
    ComboBox_AddString(comboBox1, "8192");
    ComboBox_AddString(comboBox1, "16384");
    ComboBox_AddString(comboBox1, "20000");
    ComboBox_AddString(comboBox1, "32768");
    ComboBox_AddString(comboBox1, "60000");
    ComboBox_AddString(comboBox1, "65536");
    ComboBox_AddString(comboBox2, "1");
    ComboBox_AddString(comboBox2, "10");
    ComboBox_AddString(comboBox2, "25");
    ComboBox_AddString(comboBox2, "50");
    ComboBox_AddString(comboBox2, "100");
    ComboBox_AddString(comboBox2, "200");
    ComboBox_AddString(comboBox2, "500");
    ComboBox_AddString(comboBox2, "1000");
    ComboBox_AddString(comboBox3, "TCP");
    ComboBox_AddString(comboBox3, "UDP");

    ComboBox_SetCurSel(comboBox1, 0);
    ComboBox_SetCurSel(comboBox2, 0);
    ComboBox_SetCurSel(comboBox3, 0);

    return 0;
}
Esempio n. 9
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct_)
{

#ifdef _TEST_CODE
	CDxfParserEx* creationClass = new CDxfParserEx();
	DL_Dxf* dxf = new DL_Dxf();
	if (!dxf->in("C:\\1.dxf", creationClass)) 
	{ 
		return 0;
	}
#endif

	if (CFrameWnd::OnCreate(lpCreateStruct_) == -1)
		return -1;

	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("未能创建工具栏\n");
		return -1;      // 未能创建
	}

	if (!m_wndEditToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_LEFT
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndEditToolBar.LoadToolBar(IDR_EDIT))
	{
		TRACE0("未能创建工具栏\n");
		return -1;      // 未能创建
	}

	if (!CreateComboBox(ID_COMBOBOX))
	{
		TRACE0("Failed to create combo box\n");
		return -1;
	}


	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("未能创建状态栏\n");
		return -1;      // 未能创建
	}


	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	//  m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	//  EnableDocking(CBRS_ALIGN_ANY);
	//  DockControlBar(&m_wndToolBar);

	////////////////////////////////////////////

	if( !m_wndCoolBar.Create(_T("控制栏"),this, CSize( 250, 400 ), TRUE, 123 ) )
	{ 
		TRACE0("Failed to create mybar\n"); 
		return -1;
	}

	//设置样式
	m_wndCoolBar.SetBarStyle( m_wndCoolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | 
		CBRS_SIZE_DYNAMIC );

	//设置停靠
	m_wndCoolBar.EnableDocking( CBRS_ALIGN_ANY );
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar( &m_wndCoolBar, AFX_IDW_DOCKBAR_RIGHT);///停靠

	//////

	m_wndTabCtrl.Create( TCS_DOWN | WS_CHILD | WS_VISIBLE, CRect( 0, 0, 200, 200),
		&m_wndCoolBar, 125);

	//生成TOC对话框,并加入m_wndTabCtrl中
	if( m_formDlg.Create( IDD_FORMVIEW, &m_wndTabCtrl ) )
		m_wndTabCtrl.AddPage( &m_formDlg ,_T("控制"));

	m_formDlg.ShowWindow( SW_SHOW );
	m_wndTabCtrl.UpdateWindow();

	////////////////////////////////////////////

	if( !m_wndBotmCoolBar.Create(_T("CNC控制栏"),this, CSize( 250, 165 ), TRUE, 123 ) )
	{ 
		TRACE0("Failed to create mybar\n"); 
		return -1;
	}

	//设置样式
	m_wndBotmCoolBar.SetBarStyle( m_wndBotmCoolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | 
		CBRS_SIZE_DYNAMIC );

	//设置停靠
	m_wndBotmCoolBar.EnableDocking( CBRS_ALIGN_ANY );
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar( &m_wndBotmCoolBar, AFX_IDW_DOCKBAR_BOTTOM);///停靠

	//////

	m_tabCtrlBottom.Create( TCS_UP | WS_CHILD | WS_VISIBLE, CRect( 0, 0, 200, 200),
		&m_wndBotmCoolBar, 125);

	//生成TOC对话框,并加入m_wndTabCtrl中
	

	if( m_dialogCCD.Create( IDD_FORMVIEW_CCD, &m_tabCtrlBottom ) )
	{
		m_tabCtrlBottom.AddPage(&m_dialogCCD ,_T("CCD"));
	}

	m_dialogCCD.ShowWindow( SW_SHOW );

	/*if(m_dialogCameraConfig.Create(IDD_CAMERA_CONFIG, &m_tabCtrlBottom))
		m_tabCtrlBottom.AddPage( &m_dialogCameraConfig ,_T("相机参数配置"));

	if(m_dialogImageConfig.Create(IDD_IMAGE_CONFIG, &m_tabCtrlBottom))
		m_tabCtrlBottom.AddPage( &m_dialogImageConfig ,_T("图像参数配置"));

	if(m_dialogMotionConfig.Create(IDD_MOTION_CONFIG, &m_tabCtrlBottom))
		m_tabCtrlBottom.AddPage( &m_dialogMotionConfig ,_T("运动参数配置"));

	m_dialogMotionConfig,ShowWindow(SW_SHOW);
	m_dialogImageConfig.ShowWindow(SW_SHOW);
	m_dialogCameraConfig.ShowWindow( SW_SHOW );*/
	
	m_wndTabCtrl.UpdateWindow();

	// TODO: 如果不需要工具栏可停靠,则删除这三行
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	m_wndEditToolBar.EnableDocking(CBRS_ALIGN_ANY);

	DockControlBar(&m_wndEditToolBar);

#ifdef _MAKELANG
	OnViewLanguage(IDM_View_Default);
#else
	// 列出语言文件
	if (CLanguage::List(GetSubMenu(GetSubMenu(this->GetMenu()->m_hMenu, 2), 3)) != IDM_View_Default)
	{
		CLanguage::TranslateMenu(this->GetMenu()->m_hMenu, MAKEINTRESOURCE(IDR_MAINFRAME));
	}
#endif
	
	//初始化运动控制卡
	InitMCard();

	RegistMsgWnd(m_hWnd);

	//SetTimer(100,300,NULL);
	return 0;
}
Esempio n. 10
0
// -----------------------------------------------------------------------
// Initialize Form
int CALLBACK FRMDllDef(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    int i = 0;

    switch(uMsg)
    {
        case WM_SYSCOLORCHANGE:
            ListViewSetBackColor(FRMDllDefListview, GetSysColor(COLOR_WINDOW));
            break;
        case WM_INITDIALOG:
            ControlSetText(hwndDlg, "Select procedures to export");
            FRMDllDefCmdOk = CreateButton(263, 1 + 16, 77, 23, hwndDlg, "Ok", 1, 0, 0, 0, BS_DEFPUSHBUTTON | WS_TABSTOP | WS_GROUP, Buttons_StaticEdge);
            FRMDllDefCmdCancel = CreateButton(263, 25 + 16, 77, 23, hwndDlg, "Cancel", 2, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMDllDefCmdSelAll = CreateButton(263, 51 + 16, 77, 23, hwndDlg, "Select all", 3, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMDllDefCmdUnSelAll = CreateButton(263, 75 + 16, 77, 23, hwndDlg, "Unselect all", 4, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            CreateLabel(1, 2, 250, 15, hwndDlg, "Entry point :", 0, 0, 0, 0);
            FRMDllDefComboBox = CreateComboBox(2, 17, 258, 150, hwndDlg, "", 5, 0, CBS_DROPDOWNLIST | WS_TABSTOP);
            CreateLabel(1, 40, 250, 15, hwndDlg, "Exports :", 0, 0, 0, 0);
            FRMDllDefListview = CreateListView(2, 55, 258, 238, hwndDlg, 6, 0, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_LABELTIP, LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | WS_TABSTOP, WS_EX_STATICEDGE);
            ListViewAddCol(FRMDllDefListview, "", 300, 0);
            ComboBoxAddItem(FRMDllDefComboBox, "[None]", -1);
            FreezeTimer = 1;
            ComboBoxSetIndex(FRMDllDefComboBox, DllDefFillFilesList());
            ListViewSetItemSel(FRMDllDefListview, 0);
            SetFocus(FRMDllDefComboBox);
            return(0);
        case WM_NOTIFY:
            if(ControlGetNotifiedhWnd(lParam) == FRMDllDefListview)
            {
                switch(ControlGetNotifiedMsg(lParam))
                {
                    case NM_DBLCLK:
                        ListViewCheckBoxItemDoubleClick(FRMDllDefListview);
                        return(0);
                }
            }
            break;
        case WM_COMMAND:
            if((HWND) lParam == FRMDllDefCmdOk)
            {
                SaveDllDef();
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMDllDefCmdCancel)
            {
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMDllDefCmdSelAll)
            {
                for(i = 0; i <= ListViewItemCount(FRMDllDefListview) - 1; i++)
                {
                    ListViewSetItemCheckbox(FRMDllDefListview, i, 1);
                }
                return(0);
            }
            else if((HWND) lParam == FRMDllDefCmdUnSelAll)
            {
                for(i = 0; i <= ListViewItemCount(FRMDllDefListview) - 1; i++)
                {
                    ListViewSetItemCheckbox(FRMDllDefListview, i, 0);
                }
                return(0);
            }
            break;
        case WM_CLOSE:
            StringReleaseSplit(DllDefArray);
            FreezeTimer = 0;
            EndDialog(hwndDlg, 0);
    }
    return(0);
}