|
great work but how can i put edit control int the toolbar and read/write its value?????
Shabrawy
Programmer from egypt
|
|
|
|
|
|
but i want it in a toolbar
Shabrawy
Programmer from egypt
|
|
|
|
|
The underlying control is the same, so the same techniques should apply.
Regards,
João Paulo Figueira
Embedded MVP
|
|
|
|
|
i use the following code to put an edit control in the toolbar
/*************/
HWND b=NULL;
HWND hBar=NULL;
HINSTANCE hInst = AfxGetInstanceHandle();
CCeCommandBar* pCMDBar = (CCeCommandBar*)this->m_pWndEmptyCB;
if (pCMDBar)
{
/*SHINITDLGINFO shidi;
shidi.dwMask = 0;
shidi.hDlg = this->m_hWnd;
shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;
SHInitDialog( &shidi );
::SetForegroundWindow( shidi.hDlg );
::SHFullScreen( shidi.hDlg, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON );*/
::CommandBar_Show(m_pWndEmptyCB->m_hWnd, FALSE);
pCMDBar->DestroyWindow();
delete this->m_pWndEmptyCB;
this->m_pWndEmptyCB = pCMDBar = NULL;
SHMENUBARINFO info;
info.cbSize = sizeof(info);
info.hwndParent = m_hWnd;
info.dwFlags = 0;
info.nToolBarId = IDD_HTMLTEST_DIALOG;
info.hInstRes = ::AfxGetInstanceHandle();
info.nBmpId = 0;
info.cBmpImages = 0;
SHCreateMenuBar(&info);
HWND hwndToolbar = info.hwndMB;
hwndToolbar = ::GetWindow(hwndToolbar, GW_CHILD);
/*hwndSearchText = CreateWindow(
TEXT("edit"),
TEXT("edit"),
WS_CHILD|WS_VISIBLE|WS_BORDER|ES_LEFT|ES_NOHIDESEL|ES_AUTOHSCROLL,
125,
2,
50,
18,
hwndToolbar,
(HMENU)IDC_BAR_EDIT,//(HMENU) 1000,
hInst,
NULL);
// you create a control
::SetWindowPos( hwndSearchText, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
::EnableWindow( hwndSearchText,true);*/
CEdit m_edit;
m_edit.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|ES_LEFT|ES_NOHIDESEL|ES_AUTOHSCROLL,CRect(125,2,50,18), CWnd::FromHandle(hwndToolbar), IDC_BAR_EDIT);
::SetWindowPos( m_edit.m_hWnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
::EnableWindow( m_edit.m_hWnd,true);
CRect rectWindow;
this->GetWindowRect(rectWindow);
rectWindow.bottom = 320;
this->MoveWindow(rectWindow);
m_hwndToolbar = CommandBar_Create(hInst, this->m_hWnd, 10000);
CommandBar_InsertMenubar(m_hwndToolbar, hInst, IDD_HTMLTEST_DIALOG, 0);
::SetWindowPos(m_hwndToolbar, HWND_TOP, 0, 320-CommandBar_Height(m_hwndToolbar)-rectWindow.top, 0, 0, SWP_NOSIZE);
CommandBar_Show(m_hwndToolbar, TRUE);
//CommandBar_DrawMenuBar( m_hwndToolbar, 0);
}
/****************/
but the edit control is disabled and deosnot accept any input
what can i do??
thanks
Shabrawy
Programmer from egypt
|
|
|
|
|
i am using a dialog based project and i use the follwing code to display the edit control in the toolbar
/****************/
HINSTANCE hInst = AfxGetInstanceHandle();
CCeCommandBar* pCMDBar = (CCeCommandBar*)this->m_pWndEmptyCB;
if (pCMDBar)
{
::CommandBar_Show(m_pWndEmptyCB->m_hWnd, FALSE);
pCMDBar->DestroyWindow();
delete this->m_pWndEmptyCB;
this->m_pWndEmptyCB = pCMDBar = NULL;
SHMENUBARINFO info;
info.cbSize = sizeof(info);
info.hwndParent = m_hWnd;
info.dwFlags = 0;
info.nToolBarId = IDD_DROPDOWNTREE_DIALOG;
info.hInstRes = ::AfxGetInstanceHandle();
info.nBmpId = 0;
info.cBmpImages = 0;
SHCreateMenuBar(&info);
HWND hwndToolbar = info.hwndMB;
hwndToolbar = ::GetWindow(hwndToolbar, GW_CHILD);
HWND hwndSearchText = CreateWindow(
TEXT("edit"),
TEXT("Edit"),
WS_CHILD|WS_BORDER|ES_NOHIDESEL,
125,
2,
50,
18,
hwndToolbar,//this->m_hWnd,
(HMENU)IDC_BAR_EDIT,//(HMENU) 1000,
hInst,
NULL);
::SetWindowPos( hwndSearchText, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
::EnableWindow( hwndSearchText,false);
::EnableWindow( hwndSearchText,true);
::ShowWindow( hwndSearchText,true);
CWnd::FromHandle(hwndSearchText)->SetFocus();
CWnd::FromHandle(hwndSearchText)->ModifyStyle( ES_READONLY, 0);
::BringWindowToTop(hwndSearchText);
CRect rectWindow;
this->GetWindowRect(rectWindow);
rectWindow.bottom = 320;
this->MoveWindow(rectWindow);
::BringWindowToTop(hwndSearchText);
m_hwndToolbar = CommandBar_Create(hInst, this->m_hWnd, 10000);
CommandBar_InsertMenubar(m_hwndToolbar, hInst, IDD_DROPDOWNTREE_DIALOG, 0);
::SetWindowPos(m_hwndToolbar, HWND_TOP, 0, 320-CommandBar_Height(m_hwndToolbar)-rectWindow.top, 0, 0, SWP_NOSIZE);
CommandBar_Show(m_hwndToolbar, TRUE);
//::SetWindowPos( hwndSearchText, HWND_TOPMOST, 125, 302, 50, 18, SWP_SHOWWINDOW);
}
/*****************/
but the edit control is disabled(Read Only) and deosnot accept any input
what can i do??
thanks
Shabrawy
Programmer from egypt
|
|
|
|
|
I was looking for a way to add a menu to a dialog-based MFC application under Windows CE, something that seems impossible because CWnd::SetMenu is not available. I couldn't find any information anywhere that even acknowledged that it was possible to add a menu to a dialog.
Although this article didn't give me the information I needed, it pointed me in the right direction: To add a menu to a CDialog-based MFC PocketPC application (under eMVC 3.0, Windows CE 3.0), do the following:
(1) Add a CCeCommandBar member to the CDialog-derived class
(2) In the InitDialog override function, call CCeCommandBar::Create and CCeCommandBar::InsertMenuBar methods.
|
|
|
|
|
Hi,
Ho do I increase the height of the Command Bar. I can able to increase the second & third command bar. But I couldn't the default one. I've increased the toolbar button size as 32 x 32.
How should I do..
Thanx
Rgds..
MY Code : It's working fine for second & third
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
DWORD dwStyle = WS_CHILD | CBRS_ALIGN_BOTTOM | CBRS_BORDER_TOP;
CRect rcBorder(0, 15, 0, 0);
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// create a view to occupy the client area of the frame
if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
m_wndCommandBar.m_bShowSharedNewButton = TRUE;
m_ToolTipsTable[0] = MakeString(IDS_NEW);
m_ToolTipsTable[1] = MakeString(IDS_FILE);
m_ToolTipsTable[2] = MakeString(IDS_MHELP);
m_ToolTipsTable[3] = MakeString(IDS_TOOLBAR1);
m_ToolTipsTable[4] = MakeString(IDS_TOOLBAR2);
m_ToolTipsTable[5] = MakeString(IDS_ABOUT);
if(!m_wndCommandBar.CreateEx(this,TBSTYLE_FLAT,dwStyle | WS_VISIBLE | CBRS_FLYBY ,rcBorder) ||
// !m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME)||
!m_wndCommandBar.AddAdornments() ||
!m_wndCommandBar.LoadToolBar(IDR_MAINFRAME) ||
!m_wndCommandBar.SendMessage(TB_SETTOOLTIPS, (WPARAM)(6), (LPARAM)(m_ToolTipsTable)))
{
TRACE0("Failed to create CommandBar\n");
return -1; // fail to create
}
m_wndCommandBar.SetBarStyle(m_wndCommandBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY );
...
...
}
K.Kumar
|
|
|
|
|
K.Senthil Kumar wrote:
Ho do I increase the height of the Command Bar.
The command bar is created using a specific API call. I believe you cannot change its height...
Regards,
João Paulo
|
|
|
|
|
Hi, I need to increase the toolbar buttons to size as 32 x 32. I can increase the width and also the height of toolbar buttons but they are not completed display in the toolbar - why is this?
Regards,
Carmen Panturu
|
|
|
|
|
I am using multiple CFormViews. I have 2 buttons on my toolbar 'Back' and 'Next'. In some views both the buttons are to be disabled, in others one button is to be enabled while the other is to be disabled, and in other views both are to be enabled.
m_wndCommandBar.SendMessage(TB_ENABLEBUTTON, WPARAM)(ID_PREVIOUS),(LPARAM)MAKELONG(FALSE,0));
m_wndCommandBar.SendMessage(TB_ENABLEBUTTON, (WPARAM)(ID_NEXT),(LPARAM)MAKELONG(FALSE,0));
This doesnt work.
Please help.
|
|
|
|
|
annamammen wrote:
This doesnt work
It should work... Are you sure that m_wndCommandBar is the command bar you want to refer to? Does this object have a valid window handle (try using IsWindow(m_wndCommandBar) ).
Regards,
João Paulo
|
|
|
|
|
Thanks !
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Good detective work... thanks!
|
|
|
|
|