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
M

moobob

@moobob
About
Posts
43
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Control Limits
    M moobob

    I believe the limit is in the GUI portion of the tool. It does appear to be limited to 255 controls. If I remove 3 controls, I can add only 3 more. I can however, add controls by manually editing the .rc and resource.h files. Thanks for your input, Bob

    C / C++ / MFC question

  • Control Limits
    M moobob

    Does anyone know if there is a limit in VC as to the number of controls you may place on a dialog? I know it sounds like a bizare dialog, but I have 255 controls on it, and am unable to place anymore. When I select a control from the palette and try to draw it on the dialog nothing happens. If I copy a control from the dialog and attempt to paste it, the paste button will not become active. I'm sure you're wondering why one would have so many controls on a dialog, it has 200 check boxes which display a status of a device and labels for groups of the check boxes. I need to have 25 more check boxes. Does anyone know if 255 is the limit for the number of controls one can place on a dialog? I've exited and come back into VC, thinking maybe that would work, but no luck. Any suggestions would be appreciated. Thanks in advance, Bob

    C / C++ / MFC question

  • Modal MessgeBox Problem
    M moobob

    I am trying to determine if the control that focus is going to next is on my app's window. Here is how I am attempting to do this

    void DataImportDlg2::OnKillfocusProtocolNameCb(CWnd* pNewWnd )
    {
    CString protoName;

    // CWnd *pMainWnd = (CWnd *) AfxGetApp()->m_pMainWnd;
    CWnd *pMainWnd = (CWnd *) AfxGetMainWnd();

    BOOL child = pMainWnd->IsChild(pNewWnd);
    

    When I click on a control on my apps window, the IsChild returns FALSE. I would expect it to return TRUE. What am I doing wrong? Thanks in advance, Bob

    C / C++ / MFC help question

  • Modal MessgeBox Problem
    M moobob

    I think I need to determine if the focus is going to a window outside my app. How do I do that? Here is the code.

    void DataImportDlg2::OnKillfocusProtocolNameCb()
    {
    CString protoName;

    // Get the protocol item just typed in.
    m\_protocolNameCB.GetWindowText(protoName);
    
    // If an item was typed in
    // verify this protocol exists.
    if (protoName.GetLength() > 0)
    {
        int index = m\_protocolNameCB.FindStringExact(0, protoName);
    
        if (index == CB\_ERR)
        {
            MessageBox (\_T ("Protocol does not exist, to create it, use the Create Protocol button"),
                        \_T ("Data Import"), 
                        MB\_ICONERROR | MB\_OK | MB\_APPLMODAL | MB\_TOPMOST);
    
            m\_protocolNameCB.SetFocus();
        }
    

    Thanks, Bob

    C / C++ / MFC help question

  • Modal MessgeBox Problem
    M moobob

    I have a problem with my app when displaying a MessageBox to indicate an error. I display the message box in a losingFocus callback, if the value of a dialog field is out of range. Most times the message box behaves correctly. The problem occurs when the user clicks in a window outside the application, the message box gets displayed and keeps reappearing when the OK button is pressed. This will continue for 10-20 times before the dialog will stop appearing. I have tried all three of the modality values (MB_APPLMODAL, MB_SYSTEMMODAL, MB_TASKMODAL) with the same results. Any suggestions as to how I can make the messagebox behave properly when the user clicks outside my application? Thanks in advance, Bob

    C / C++ / MFC help question

  • CListBox scrollbar problem
    M moobob

    Thanks! that did the trick. Bob

    C / C++ / MFC help question

  • CListBox scrollbar problem
    M moobob

    I'm having a problem making the horizontal scrollbars appear in a list box in my application. I created it with the dialog editor and have the horizontal & vertical scrollbar boxes checked on the properties dialog. The vertical scrollbar does appear when the enough items are placed in the box. However, the horizontal never appears. i've tried moving controls around to insure their is room for the scroll bars to appear. I've compared the properties to another list box in the application which does display the horiz scroll bars when necessary. Are there any situations that anyone knows which would cause the scroll bars not to appear in a CListBox? Thanks in advance, Bob

    C / C++ / MFC help question

  • CFileDialog SaveAs Question
    M moobob

    Thanks Chris!

    C / C++ / MFC question

  • CFileDialog SaveAs Question
    M moobob

    Chris, Thanks for your response. I tried as you suggested, but it crashes. If I do a CFileDialog dlg(FALSE, "*.imp", NULL, NULL, szFilter); CWnd *wnd = dlg.GetDlgItem(IDOK); it crashes on the dlg.GetDlgItem call. dlg.hWnd = 0. Perhaps I'm doing this in the wrong place? Thanks, Bob

    C / C++ / MFC question

  • CFileDialog SaveAs Question
    M moobob

    Is there anyway to change the Save button text of the SaveAs dialog of the CFileDialog class to be something else? Thanks in advance, Bob

    C / C++ / MFC question

  • map.find() problems
    M moobob

    Alex, Making the key a CString worked!!! Thank you very much for your help! Bob

    C / C++ / MFC debugging c++ graphics help question

  • map.find() problems
    M moobob

    I am using a key of const char *, the data is struct. How would I specify a comparison method for char *? thanks, Bob

    C / C++ / MFC debugging c++ graphics help question

  • map.find() problems
    M moobob

    Alex, Thanks for your response, sorry, I don't know how to format my code for the post, can you please tell me how? Since I don't provide a sorting criterion when I define my map, it should use the default less <>? I don't really understand the sorting criterion very well. I can see my items don't appear to be sorted. All I want to do is insert items and find items. How should I specify it? thanks, Bob

    C / C++ / MFC debugging c++ graphics help question

  • map.find() problems
    M moobob

    I'm having a strange problem with the STL map.find(). I have a function which I search for an item's existance with a find() before inserting. If I don't find it, I insert it. Trouble is, when an item already exists in the map, both the find() and count() never report it. Also, the insert() lets me add a duplicate key. Below find declarations, code, and debug output. // declarations typedef struct ImportDataType { CString Item; CString Value; char Type; long ReplicationID; } ImportDataType; typedef vector dataVector; typedef map importData; map::const_iterator mapIter; int i = dataMap.count(m_currentEID); int j = dataMap.size(); TRACE ("\nIn AddDataItem, b4 map.insert(), size of Map = %d\n",j); TRACE ("Number of items in the Map with key of %s = %d\n",m_currentEID,i); mapIter = dataMap.find(m_currentEID); if (mapIter != dataMap.end()) TRACE ("B4 insert, key found in map!\n"); else TRACE ("B4 insert, key not found in map!\n"); for (mapIter = dataMap.begin(); mapIter != dataMap.end(); mapIter++) { TRACE ("Key from Map = %s\n", (*mapIter).first); } dataMap.insert(make_pair(m_currentEID, dataVector)); mapIter = dataMap.find(m_currentEID); if (mapIter != dataMap.end()) TRACE ("After insert, found key in map!\n"); else TRACE ("After insert, key not found in map!\n"); i = dataMap.count(m_currentEID); j = dataMap.size(); TRACE ("\nIn AddDataItem, after map.insert(), size of Map = %d\n",j); TRACE ("Number of items in the Map with key of %s = %d\n",m_currentEID,i); for (mapIter = dataMap.begin(); mapIter != dataMap.end(); mapIter++) { TRACE ("Key from Map = %s\n", (*mapIter).first); } The partial output from running this shows the problem. Note the key values are being printed before the insert is done. The key 6748 does exist, but the map.count() and map.find() are not reporting it. Note in the last dump of the map keys that 6748 is there twice! What am I doing wrong? In AddDataItem, b4 map.insert(), size of Map = 3 Number of items in the Map with key of 982000006006748 = 0 B4 insert, key not found in map! Key from Map = 982000006003798 Key from Map = 982000007172537 Key from Map = 982000006006748 After insert, found key in map! In AddDataItem, after map.insert(), size of Map = 4 Number of items in the Map with key of 982000006006748 = 1 Key from Map = 982000006003798 Key from Map = 982000007172537 Key fr

    C / C++ / MFC debugging c++ graphics help question

  • Passing a control id
    M moobob

    That works, except I have to change my argument name from list, since it thinks I'm referencing the STL list. Thanks, Bob

    C / C++ / MFC question database help

  • Passing a control id
    M moobob

    I have some code which sets the item data on a list box depending on some data attributes. I have multiple list boxes in my application and always want to set the item data the same way. To do this I need to pass as a parameter the control id of the list box in question. That way I can do a listbox.SetItemData (fieldNum, 1); How do I specify the type of listbox in my code? Here is the prototype and code. void DataImportDlg2::SetMapType(CListBox list, LPCTSTR fieldName, int fieldNum) { DbHelper::InputType inputType; DbHelper dbHelper; // Set the additional data flag which indicates whether // the item is a value mapping type or not. 1 indicates it is, // a 0 means no. inputType = dbHelper.GetItemsInputType (fieldName); if (inputType == DbHelper::A) list.SetItemData (fieldNum, 1); else list.SetItemData (fieldNum, 0); } I make the call like this: SetMapType (m_availFieldList, *iter, index); which gives me a compile error 'cannot convert parameter 1 from 'class CListBox' to 'class CListBox' Any ideas on what type to make the list parameter? Thanks in advance, Bob

    C / C++ / MFC question database help

  • File Type Association
    M moobob

    Thanks for the help.

    C / C++ / MFC tutorial question

  • File Type Association
    M moobob

    Is there anyway in code to create a file association. i.e. I want to associate a file type of .log with notepad. I know how to do this via Windows explorer, can I do this at runtime? Thanks in advance, Bob

    C / C++ / MFC tutorial question

  • Kill Focus/Next Action
    M moobob

    GetFocus() does the trick, Thanks! Bob

    C / C++ / MFC data-structures help question

  • Kill Focus/Next Action
    M moobob

    OK, that explains what I was seeing. Is there anyway to get the ID of the control that is about to receive focus when in the OnKillFocus? Thanks, Bob

    C / C++ / MFC data-structures help question
  • Login

  • Don't have an account? Register

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