954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with Getting text from combobox

Hi,

I'm having a problem with retrieving the text from a combobox. When i do the index of where the text is in the combobox is returned as well as the text.

My code is as follows:

//default video format
  dirac_encoder_presets_t preset = VIDEO_FORMAT_CUSTOM;
 
  //get the video format selected by the user
  VideoFormat = FormatTypeComboBox->Text();
 
  if(VideoFormat == "QCIF")
  {
        preset = VIDEO_FORMAT_QCIF;
  }


The preset value is set to 3/*VIDEO_FORMAT_QCIF*/
where 3 is the index of VIDEO_FORMAT_QCIF.

I'm really baffled by this :rolleyes:

Can anybody help?

Thanks:)

elodie
Newbie Poster
5 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

Shouldn't you be using strcmp instead of == for comparing strings? Or am I just as baffled as you? :eek:

TylerSBreton
Junior Poster in Training
89 posts since Oct 2006
Reputation Points: 25
Solved Threads: 3
 
Shouldn't you be using strcmp instead of == for comparing strings?

depends on how VideoFormat is declared.

>> VideoFormat = FormatTypeComboBox->Text();
Is this MS-Windows combo box? or something else, such as *nix? what compiler and os are you using?

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

I'm using Borland C++ builder.

the strcmp doesn't seem to make a difference either and i tried using ItemIndex instead of text to compare with and the result was still the same. the index infront of the preset value.
Really strange!!!!

elodie
Newbie Poster
5 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You