problem with popupField.... (my problem remaining...)

Login to reply to this topic.
Fri, 2004-11-19 17:13
Joined: 2004-10-27
Forum posts: 169
I have a popUpFiled,

   CTestFormCountry* dlg = CTestFormCountry::NewLC();
   CleanupStack::Pop();
   if(dlg->ExecuteLD(aResourceId) == KErrNone)
   {
      //...
   }

with executing this code, I will see a Dialog which has a popUpField in it
(my dialog contains only a popupField)
and too softKeys:
  Back  (to return to my container)
  Option  (for editing or saving)

I want to have the selected index of popupField when I press Back softkey
In real I want my label in my Container show me this index,
But this value should be pass through my dialog to container,...

To do this,I wrote some code in OkToExitL method of my dialog,
I mean I initialize a member variable (TInt nTest) with the selected Index of
popupField in this method,
and return this value in a public method of this Dialog (GetSelectedIndex)
///
TInt GetSelectedIndex()
{
  return nTest;  //nTest evaluated in OkToExitL method
}
///

But when I call the GetSelectedIndex method in my container, it doesn't return the true value,
I think the reason is that this method is called earlear than BACK pressing in dialog...


   CTestFormCountry* dlg = CTestFormCountry::NewLC();
   CleanupStack::Pop();
   if(dlg->ExecuteLD(aResourceId) == KErrNone)
   {
      TInt aIndex =  dlg -> GetSelectedIndex();
   }

But I don't know what should I do,

Huh

Sat, 2004-11-20 21:29
Joined: 2003-04-03
Forum posts: 39
problem with popupField.... (my problem remaining...)
ExecuteLD this function means that object could Leave and Destroy after this function complite. In other words "dlg" destroyed after your call ExecuteLD, on device you will get KERN-EXEC 3 (access vialation) after call  GetSelectedIndex().

I think you need to pass "nTest" as argument for  CTestFormCountry::NewLC.
Sun, 2004-11-21 11:50
Joined: 2004-10-27
Forum posts: 169
problem with popupField.... (my problem remaining...)
ok,
Draw method in my Container is working with this nTest value and update the appearence of container UI based on the value of nTest,
and I know whenever I save my popupfield dialog and press back softkey, my dialog hide and so the Draw method of my container will be called by system(automatically),
Then I want my nTest be updated when the back is pressed,(I think in OkToExit method of my Dialog)

nTest is a member variable of my Container,
So I think I should pass it by reference to my Dialog, but NewLC method of my dialog cannot accept it as an argument,

What should I do? and how can pass it to my Dialog class?

Thank you
Mon, 2004-11-22 06:46
Joined: 2004-10-27
Forum posts: 169
problem with popupField.... (my problem remaining...)
Then it solved,  Shocked
by using CEikonEnv Static() method of CEikonEnv,,

Thanks God...  Cheezy
  • Login to reply to this topic.