Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

gajendrakashyap

@gajendrakashyap
About
Posts
25
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Owner draw combobox for modeless dialog
    G gajendrakashyap

    I need a help with controlling the painting of combobox control on modeless dialog displayed on a parent dialog. Can someone help me with this? :) Thanks, Gajendra

    Article Writing help question

  • Owner draw combobox problem
    G gajendrakashyap

    Ya it should be because it gives this problem only when I set the combobox property to Drop List rather than Drop down. I'm not able to find a way to do it as per my requirements :sigh: Regards, Gaj

    C / C++ / MFC help tutorial question

  • Owner draw combobox problem
    G gajendrakashyap

    Thanks for that Prasad... I tried the option. There are two problems with this approach: 1. It does not paint the combobox with the colors that i chose. 2. The selected text is not displayed back in the combobox edit area even if I set the index in the function mapped to ON_CBN_SELCHANGE message. Can you suggest something on that? :) Thanks, Gaj

    C / C++ / MFC help tutorial question

  • Owner draw combobox problem
    G gajendrakashyap

    Yes I'm using DDX control. I created the ctrl using drag and drop. Then I created the modeless dlg in OnInitDialog()function of Parent wnd as follows. Modeless_Dlg* ptr_dlg = new Modeless_Dlg(); if(ptr_dlg) { ptr_dlg->Create(IDD_DIALOG_MODELESS, this); ptr_dlg->ShowWindow(TRUE); ptr_dlg->m_combo.AddString("FIRST"); ptr_dlg->m_combo.AddString("SECOND"); ptr_dlg->m_combo.AddString("THIRD"); } else AfxMessageBox("Error creating dlg"); The overridden drawitem method: void CCustomComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { // TODO: Add your code to draw the specified item ASSERT(lpDrawItemStruct->CtlType == ODT_COMBOBOX); LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData; ASSERT(lpszText != NULL); CDC dc; dc.Attach(lpDrawItemStruct->hDC); ASSERT(lpDrawItemStruct->hwndItem = CWnd::GetSafeHwnd()); // Save these value to restore them when done drawing. COLORREF crOldTextColor = dc.GetTextColor(); COLORREF crOldBkColor = dc.GetBkColor(); // If this item is selected, set the background color // and the text color to appropriate values. Erase // the rect by filling it with the background color. CBrush br(RGB(255, 0, 0)); if ((lpDrawItemStruct->itemAction | ODA_SELECT) && (lpDrawItemStruct->itemState & ODS_SELECTED)) { // Sets current cursor item color and selected item color dc.SetTextColor(RGB(0, 255, 255)); // has no effect //dc.SetBkColor(RGB(255, 0, 0)); // sets current cursor item background dc.FillSolidRect(&lpDrawItemStruct->rcItem, RGB(0, 0, 0)); if ((lpDrawItemStruct->itemState | ODS_SELECTED) | (lpDrawItemStruct->itemAction & ODA_SELECT) ) dc.FrameRect(&lpDrawItemStruct->rcItem, &br); } else { // Sets list opening color and default combobox item color dc.SetTextColor(RGB(0, 255, 255)); dc.FillSolidRect(&lpDrawItemStruct->rcItem, RGB(0, 0, 0)); } // Draw the text. dc.DrawText( lpszText, strlen(lpszText), &lpDrawItemStruct->rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER); // Reset the background color and the text color back to their // original values. dc.SetTextColor(crOldTextColor); dc.SetBkColor(crOldBkColor); dc.Detach(); } Thats all the code I've added to the generated code. I hope this helps you to figure out the problem... Thanks, Gaj

    C / C++ / MFC help tutorial question

  • Owner draw combobox problem
    G gajendrakashyap

    I've referred articles from there. The examples work on simple dialogs but not in my kind of scenario. Can you try to recreate the scenario as I've mentioned and then provide me a soln if possible? Thanks, Gajendra

    C / C++ / MFC help tutorial question

  • Owner draw combobox problem
    G gajendrakashyap

    I'm getting the exception in this call, dc.DrawText( lpszText, strlen(lpszText), &lpDrawItemStruct->rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER); I just directly reused the code from "http://msdn2.microsoft.com/en-us/library/y5hb5f9t(VS.80).aspx[^]" I think you can reproduce the problem with this code. Regards, Gajendra

    C / C++ / MFC help tutorial question

  • Owner draw combobox problem
    G gajendrakashyap

    In my appliaction I've modeless child dialog on the main application dialog. On the child dialog there is a combobox with properties set as: Type->Drop List; Owner draw->Fixed; Vertical scroll checked. I've derived a new class from base CComboBox class and overridden the DrawItem method in base class. I used the code available in MSDN inside this method. When I execute the application it gives a runtime error. Can someone guide me how to solve the problem or implemement the owner drawn combobox ? The same code works fine when the combobox is used on the main application dialog but not on the modeless dialog. Please help. Thanks, Gajendra

    C / C++ / MFC help tutorial question

  • Editbox identification problem
    G gajendrakashyap

    Thanks Alok. Actually i tried that, but misspelt the name of function :( I could work from your first clue itself. Thanks for the help !! :) Thanks & regards, Gajendra

    C / C++ / MFC help database

  • Editbox identification problem
    G gajendrakashyap

    Using this I can get a pointer to the ebox. If I could get the ID number of the ebox in context, it would help me more than having a pointer as my application logic depends on that. Can you suggest something on obtaining focussed ebox control id number?

    C / C++ / MFC help database

  • Editbox identification problem
    G gajendrakashyap

    Using this I can get a pointer to the ebox. If I could get the ID number of the ebox in context, it would help me more than having a pointer as my application logic depends on that. Can you suggest something on obtaining focussed ebox control id number? Thanks, Gajendra

    C / C++ / MFC help database

  • Editbox identification problem
    G gajendrakashyap

    Hi All, I've created a dialog based application with the dialog having multiple editboxes. What I want to achieve is to call a specific function when I press "Enter" key. Each editbox should trigger its specific function or I should be able to know from which editbox the enter key was pressed. Please help. Thanks, Gajendra

    C / C++ / MFC help database

  • Context menu problem
    G gajendrakashyap

    Till now I had only single context menu for that dialog. Will try to add another one for another dialog and lets see then. Regards, Gajendra

    C / C++ / MFC help learning

  • Context menu problem
    G gajendrakashyap

    I have problem with only this one becuase it works on others. I can't reveal the complete code to you :sigh: But its ok, I think I know the solution what needs to be done. Thanks much for your time and help. :) Regards, Gajendra

    C / C++ / MFC help learning

  • Context menu problem
    G gajendrakashyap

    Can you explain me your design if it differs from mine in some way? thanks for your help. Gajendra

    C / C++ / MFC help learning

  • Context menu problem
    G gajendrakashyap

    Yes the IDs are unique. I've ResOrgAddin tool to check that. I got the problem just a few mins back. I don't know if I can load an image here but the I'll try to explain the design. I've a main dialog for the application, lets call this parent. I've several child dialogs which are displayed overlayed on this parent dialog. I implemented context menu only for one of the child dialog... it did not work as expected. Although the context menu was displayed the commands were not getting generated ... Surprising. Now I implemented the contextmenu on the parent dialog and it works as expected jst need to control the display on right dialog. I don't think it is the right way to do... but it is working. If i could send and handle the commands from the right dialog on which context menu is displayed would be the best situation. Let me know your valuable opinion. :) Thanks, Gaj

    C / C++ / MFC help learning

  • Context menu problem
    G gajendrakashyap

    The problem is that the commands from context menu are not working. The corresponding mapped function is not called when something is selected in the menu. Gaj

    C / C++ / MFC help learning

  • Context menu problem
    G gajendrakashyap

    This is in message maps: ON_COMMAND(ID_DIR_REVN_MENU, On_Dir_Revn_Menu) ----------------------------------------------------------------------- I've customised the display of context menu to deligate to another function. The context menu code is loaded properly and displayed. // called from the original OnContextMenu void CFPLN_PAGE_Dialog::On_Fpln_Revn_Menu(CPoint point) { point.x = 90; point.y = 95; ClientToScreen(&point); CMenu m_Fpln_Revn_Menu, *m_Ptr_ContextMenu; m_Fpln_Revn_Menu.LoadMenu(IDR_FPLN_REVN_MENU); m_Ptr_ContextMenu = m_Fpln_Revn_Menu.GetSubMenu(0); ASSERT(m_Fpln_Revn_Menu); m_Ptr_ContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, point.x, point.y, AfxGetMainWnd()); } ----------------------------------------------------------------------- Then the command handler code is: void CFPLN_PAGE_Dialog::On_Dir_Revn_Menu() { // TODO: Add your command handler code here AfxMessageBox("dir revn menu"); } Is this ok for you to guess something...? Let me know if you want to know more about the problem. You can mail to me: "gajendra.kashyap@valtech.co.in" Thanks, Gajendra

    C / C++ / MFC help learning

  • Context menu problem
    G gajendrakashyap

    Hi everyone !! I've a dialog based application in which I've added a context menu. I had previously defined a menu similar to file menu which works fine. Recently I added a context menu for one of the dialogs. It is not working :(( I checked the resource file for any duplicate id's and corrected that also but nothing seems to be helping me. Here is what I did. 1. Added a context menu in Resource->Menu. 2. Added a context menu command handler for that dialog. 3. Added command handler for each of the ID in this menu. When I compile, build and run the application it gives no errors but the commands from this context menu are not working. :(( When I try implementing a context menu with another project it works fine. :confused: Please help Thanks, Gajendra

    C / C++ / MFC help learning

  • File streaming problem
    G gajendrakashyap

    Yes I could find articles on word, powerpoint, excel, outlook etc. Not a problem as I can use excel also for my project. We've made a program in VB that reads excel and gives the output we need. We're working to refine it. I think MFC would also be great at work. Thanks, Gajendra

    C / C++ / MFC c++ question help

  • File streaming problem
    G gajendrakashyap

    Hi David, All this is going to help me a lot. I will try to work out on these sample codes. I could not find the last article Q192348. Thanks much for the help. Regards, Gajendra

    C / C++ / MFC c++ question help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups