[RESOLVED] Regarding member function
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] Regarding member function

  1. #1
    Join Date
    Feb 2013
    Posts
    9

    [RESOLVED] Regarding member function

    Hi,

    I was reading a c++ code written in embarcadero ide to add vertical colour text in popup menu.

    While reading the code, I had seen following instructions.

    private:
    Code:
    void __fastcall ExpandMenuItemWidth(TObject *Sender, TCanvas *ACanvas,int &Width, int &Height);
    Code:
    void __fastcall DrawNewItem(TObject *Sender, TCanvas *ACanvas, const TRect &ARect, bool Selected);
    The above two methods used in the code like below:
    Code:
    PopupMenu1->Items->Items[i]->OnMeasureItem = ExpandMenuItemWidth;
    
    PopupMenu1->Items->Items[i]->OnDrawItem = DrawNewItem;
    What is happening when we are using member function without parameters like above?
    I found above code at: http://edn.embarcadero.com/article/26632
    Thanks in advance,

  2. #2
    Join Date
    Apr 1999
    Posts
    27,422

    Re: Regarding member function

    A function name is a pointer. So all you're doing is assigning the pointer to the function to another variable. Later on, that variable will call the function that it was assigned.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Feb 2013
    Posts
    9

    Re: Regarding member function

    Quote Originally Posted by Paul McKenzie View Post
    A function name is a pointer. So all you're doing is assigning the pointer to the function to another variable. Later on, that variable will call the function that it was assigned.

    Regards,

    Paul McKenzie
    Thanks for your answer.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center