ComboBox problem

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
cyrixware
Earned some good credits
Earned some good credits
Posts: 103
Joined: Mon Apr 17, 2006 1:24 pm
Location: Philippines
Contact:

ComboBox problem

Post by cyrixware » Wed May 31, 2006 1:40 pm

Hi to all! i wanna ask some questions regarding this. I have 2 wxDialog the first one located the wxNotebook wer all the contacts located. The other located the ComboBox where i can enter the number. The problem is that when i click the number or contacts from (wxNotebook) located in the first wxDialog the number will appear at the ComboBox located in the second wxDialog.

Code: Select all

DIALENTRYPANEL.CPP

PhoneState* DialEntryPanel::DialEntryPhoneStateMachineObserver::OnRinging(SIPX_CALL hCall)
{
    char szIncomingNumber[256];
    sipxCallGetRemoteID(hCall, szIncomingNumber, 256);
    wxString incomingNumber(szIncomingNumber);

    wxCommandEvent comboEvent(ezEVT_UPDATE_ADDRESS_COMBO); 

    mpOwner->mAddressString = incomingNumber;
    wxPostEvent(mpOwner, comboEvent);

    return NULL;
}

void DialEntryPanel::OnProcessUpdateAddressCombo(wxCommandEvent& event)
{
    if (getComboBox().FindString(mAddressString) == -1)
    {
      getComboBox().Append(mAddressString);	  
    }

}

CONTACTLISTPANEL.CPP

void ContactListPanel::OnSelectContact(wxListEvent& event)
{
    wxString name ;
    wxString url ;
	wxString cert;
    wxListItem item ;

    item.m_itemId = event.m_itemIndex;
    item.m_col = 0;
    item.m_mask = wxLIST_MASK_TEXT;

    if (mpContactList->GetItem(item))
    {
        name = item.GetText() ;   
		 
    }

    item.m_itemId = event.m_itemIndex;
    item.m_col = 1;
    item.m_mask = wxLIST_MASK_TEXT;
    
    if (mpContactList->GetItem(item))
    {
        url = item.GetText() ;
	 
    }

	item.m_itemId = event.m_itemIndex;
    item.m_col = 2;
    item.m_mask = wxLIST_MASK_TEXT;
    
	if (mpContactList->GetItem(item))
    {
        cert = item.GetText() ;	 
    }
    wxString dialString ;
    dialString = cert;
    PhoneStateMachine::getInstance().OnDial(dialString);        
}
In this case after i click the contacts the number appeard at the buttom of the ComboBox (dropdown) not on the display area. What should i do? Is there any event or functions to set the number at the ComboBox display area?

:?:
WinXP SP2, VS.NET
wxDev-C++ 4.9.9.2, wxWindows-2.4.2
Need4Speed!

Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Post by Cursor » Wed May 31, 2006 1:57 pm

What about setting the combobox label directly with wxComboBox::SetValue [1] ??

[1] : http://www.wxwidgets.org/manuals/2.6.3/ ... oxsetvalue
What is little and green, witch go up and down ??
Yoda playing with the force.

cyrixware
Earned some good credits
Earned some good credits
Posts: 103
Joined: Mon Apr 17, 2006 1:24 pm
Location: Philippines
Contact:

Post by cyrixware » Wed May 31, 2006 2:22 pm

yep i tried! Heres my code on state:

Code: Select all

PhoneState* PhoneStateMachine::OnDial(wxString phoneNumber)
{
   if (mpState)
   {
	   //setState(mpState->OnDial(phoneNumber)); 
	   
	   int pos;
	   wxString copyNum;
	   copyNum = (wxString) phoneNumber;
	   pos = phoneNumber.Find("@");
		copyNum.Remove(pos);
      // notify listeners that a Dial transition is about to occur
      UtlSListIterator iterator(mObservers);
      PhoneStateMachineObserver* pObserver;
      while (pObserver = (PhoneStateMachineObserver*)iterator())
      {
          pObserver->OnDial(copyNum);
      }

      // set the state
      setState(mpState->OnDial(phoneNumber));
   }
   return NULL; // the state machine should only return state pointers from the getState method
}
I use setState(mpState->OnDial(phoneNumber)) but still the numbers display only at the dropdown area not on the upper part.
WinXP SP2, VS.NET
wxDev-C++ 4.9.9.2, wxWindows-2.4.2
Need4Speed!

Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Post by Cursor » Wed May 31, 2006 3:50 pm

Please dump your setState function code.
What is little and green, witch go up and down ??
Yoda playing with the force.

Post Reply