![]() |
Question about comboboxes on toolbars |
Post Reply ![]() |
Author | |
Ark42 ![]() Senior Member ![]() ![]() Joined: 20 October 2003 Status: Offline Points: 291 |
![]() ![]() ![]() ![]() ![]() Posted: 25 April 2004 at 5:25pm |
Here is some condensed code from my program: ON_XTP_EXECUTE(ID_VIEW_ZOOM, OnViewZoom) ON_UPDATE_COMMAND_UI(ID_VIEW_ZOOM, OnUpdateViewZoom) void CPicView::OnViewZoom(NMHDR* pNMHDR, LRESULT* pResult) { NMXTPCONTROL *tagNMCONTROL = (NMXTPCONTROL *)pNMHDR; CXTPControlComboBox *pControl = reinterpret_cast<CXTPControlComboBox *>(tagNMCONTROL->pControl); ::SetZoom(pControl->GetEditText()); *pResult = TRUE; } void CPicView::OnUpdateViewZoom(CCmdUI* pCmdUI) { CXTPControlComboBox *pControl = reinterpret_cast<CXTPControlComboBox *>(CXTPControl::FromUI(pCmdUI)); if( ::ShouldBeEnabled ) { pCmdUI->Enable(); if( GetFocus() != pControl->GetEditCtrl() ) { CString str = ::GetZoom(); if( pControl->GetEditText() != str ) { pControl->GetEditCtrl()->SetWindowText(str); } } } else { pControl->GetEditCtrl()->SetWindowText(""); } } Now, my question is why do I have to use GetEditCtrl()->SetWindowText() instead of just SetEditText() ? Calling GetEditText() seems to work just fine to retrieve it, but using SetEditText() causes all kinds of problems, particularly when I have two of the same control on the toolbar and want them to always be in sync, and when switching back and forth between two open MDI windows both using this view, and thus the zoom combo on the toolbar should reflect the active MDI window's view. I think I finally got the code working, using the GetEditCtrl()->SetWindowText() but I really want to know if I am using the combobox in the proper way, and why can't I use SetEditText() ? |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Agree, it was problem in SetEditText. fixed now. Your solution is good too. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |