Click here to Skip to main content
15,881,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Size of a dialog box Pin
Renjith Ramachandran26-Jul-05 8:45
Renjith Ramachandran26-Jul-05 8:45 
Generalwinsock2: SPI problems Pin
superstition26-Jul-05 4:39
superstition26-Jul-05 4:39 
GeneralRe: winsock2: SPI problems Pin
Peter Weyzen26-Jul-05 10:21
Peter Weyzen26-Jul-05 10:21 
GeneralRe: winsock2: SPI problems Pin
superstition26-Jul-05 20:35
superstition26-Jul-05 20:35 
QuestionCListCtrl 260 character limit???? Pin
Anonymous26-Jul-05 3:28
Anonymous26-Jul-05 3:28 
AnswerRe: CListCtrl 260 character limit???? Pin
mark novak26-Jul-05 3:46
mark novak26-Jul-05 3:46 
GeneralRe: CListCtrl 260 character limit???? Pin
Anonymous26-Jul-05 4:09
Anonymous26-Jul-05 4:09 
GeneralDynamic popup menu [edited - bis] Pin
toxcct26-Jul-05 3:04
toxcct26-Jul-05 3:04 
Good afternoon dear CPians,

i'm facing a problem with a popup menu (MFC programming, VS7.1). here is what i'm trying to do :

i have a vector that's been filled with several Phone numbers of a particuliar person.
what i need is creating a popup menu that is displayed next to the button clicked to display it.
the popup menu is supposed to contain all the entries of the vector...
<font color=blue>void</font> CFactEditorDlg::OnSClickShowNumbers() {
    <font color=blue>using namespace</font> std;
    vector<CString> vPersonNumbers;
 
    <font color=green>//filling the vector...</font>
 
    <font color=blue>if</font> (vPersonNumbers.size() != 0) {
        CMenu PhonesMenu;
        <font color=blue>if</font> (PhonesMenu.<font color=red>CreatePopupMenu()</font>) {
            vector<CString>::const_iterator itvPhoneNumbers;
            <font color=blue>int</font> iCpt = 1;
            <font color=blue>for</font> (itvPhoneNumbers = vPersonNumbers.begin();
                 itvPhoneNumbers != vPersonNumbers.end();
                 itvPhoneNumbers++, iCpt++) {
                    PhonesMenu.AppendMenu(MF_STRING, iCpt, *itvPhoneNumbers);
            }
            CRect rect;
            m_pbShowNumbers->GetWindowRect(&rect);    <font color=green>//The calling button...</font>
            PhonesMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, rect.right, rect.top, AfxGetMainWnd());
        }
    }
}

the CMenu::AppendMenu() i call give me an Unhandled exception, but no more description.

i'm certainly using CMenu the wrong way, but i cannot find any good tutorial to just create a popup menu dynamically (dynamic content) and display the place i want (by the side of the button that calls it)...

did anyone ever encounter such a problem, or know how to solve this ?


now, i would like to recover the item the user click on to put it into an EditBox...

anyone ?



TOXCCT >>> GEII power
[toxcct][VisualCalc]
GeneralRe: Dynamic popup menu Pin
mark novak26-Jul-05 3:09
mark novak26-Jul-05 3:09 
GeneralRe: Dynamic popup menu Pin
toxcct26-Jul-05 3:19
toxcct26-Jul-05 3:19 
GeneralRe: Dynamic popup menu Pin
mark novak26-Jul-05 3:33
mark novak26-Jul-05 3:33 
GeneralRe: Dynamic popup menu Pin
toxcct26-Jul-05 3:43
toxcct26-Jul-05 3:43 
GeneralRe: Dynamic popup menu Pin
mark novak26-Jul-05 3:50
mark novak26-Jul-05 3:50 
GeneralRe: Dynamic popup menu Pin
toxcct26-Jul-05 3:59
toxcct26-Jul-05 3:59 
GeneralRe: Dynamic popup menu Pin
mark novak26-Jul-05 4:15
mark novak26-Jul-05 4:15 
GeneralRe: Dynamic popup menu Pin
toxcct26-Jul-05 5:11
toxcct26-Jul-05 5:11 
GeneralRe: Dynamic popup menu Pin
mark novak26-Jul-05 5:30
mark novak26-Jul-05 5:30 
GeneralRe: Dynamic popup menu Pin
toxcct26-Jul-05 20:35
toxcct26-Jul-05 20:35 
GeneralRe: Dynamic popup menu Pin
mark novak27-Jul-05 1:54
mark novak27-Jul-05 1:54 
GeneralRe: Dynamic popup menu Pin
toxcct27-Jul-05 2:00
toxcct27-Jul-05 2:00 
GeneralRe: Dynamic popup menu Pin
mark novak27-Jul-05 2:13
mark novak27-Jul-05 2:13 
GeneralString Converstions Pin
tomek1826-Jul-05 2:59
tomek1826-Jul-05 2:59 
GeneralRe: String Converstions Pin
mark novak26-Jul-05 3:02
mark novak26-Jul-05 3:02 
GeneralRe: String Converstions Pin
tomek1826-Jul-05 3:10
tomek1826-Jul-05 3:10 
GeneralRe: String Converstions Pin
mark novak26-Jul-05 3:24
mark novak26-Jul-05 3:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.