Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to call function/pass value from one class to another in bada using C++ friend function
    primarykey
    data
    text
    <p>I know this is a basic c++ question, but may I know how can I call a function/pass value (elementId) from one class to another in bada using the friend function? </p> <p>In my form class, I have a listView and when the item in the listView has been clicked, I would like to pass the elementId to detailedForm to display info in the label (in detailedForm). In my form.h and .cpp I have included detailedForm.h, may I know how do I access the function in detailedForm to display the info? In form.h, I have also declared </p> <pre><code>friend class detailedForm; </code></pre> <p>and when I tried to use one of the function in detailedForm in my form class, namely displayInfo(); the form class has an error saying displayInfo() has not been declared. </p> <p>form.h</p> <pre><code>... public: friend class ChartFormDetail; </code></pre> <p>Here is my code for form.cpp</p> <pre><code>#include "Form.h" #include "ChartFormDetail.h" ... void Form::OnGroupedListViewItemStateChanged(Osp::Ui::Controls::GroupedListView &amp;listView, int groupIndex, int itemIndex, int elementId, Osp::Ui::Controls::ListItemStatus state) { Frame* pFrame = Osp::App::Application::GetInstance()-&gt;GetAppFrame()-&gt;GetFrame(); FormMgr* pFormMgr = dynamic_cast&lt;FormMgr*&gt; (pFrame-&gt;GetControl("FormMgr")); if(pFormMgr == null) return; pFormMgr-&gt;SendUserEvent(FormMgr::REQUEST_DETAILFORM, null); //pFormMgr-&gt;SendUserEvent(elementId, null); switch(elementId) { case ID_FORMAT_STRING_M12: DisplayLabel(); break; ... case ID_FORMAT_STRING_F19: DisplayLabel(); break; } } </code></pre> <p>detailedForm.h</p> <pre><code>public: ... void DisplayLabel(void); </code></pre> <p>code for detailedForm.cpp</p> <pre><code>void ChartFormDetail::DisplayInfo(void) { pLabel-&gt;SetText("Text here"); RequestRedraw(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload