Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » ArrayMap<String,TabCtrl::Item> - check if String exists..
ArrayMap<String,TabCtrl::Item> - check if String exists.. [message #34354] Fri, 18 November 2011 11:07 Go to next message
Wolfgang is currently offline  Wolfgang
Messages: 146
Registered: November 2011
Location: Germany
Experienced Member
Hello,

me again!

I try to create an ArrayMap<String,TabCtrl::Item> and "use" it.

Header file - definition
ArrayMap<String,TabCtrl::Item> tabNames;


IN main.cpp
--- String tabName;
--- TabCtrl tab;
tabNames.Add("first",tab.Add(loginLayout.SizePos(), t_("Login")));


This part "works" (gives no error) but HOW to check if an entry for "first" exists in tabNames?
I already tried tabNames.Find("first") but this returns false even if "first" exists in tabNames.
if (tabNames.Find("first")) PromptOK("OK");


You understand what I mean?

Re: ArrayMap<String,TabCtrl::Item> - check if String exists.. [message #34356 is a reply to message #34354] Fri, 18 November 2011 12:13 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Wolfgang,

Find() returns position of the element in the container, or ńegative number if it doesn't exist. So you should use something like
if (tabNames.Find("first")>=0) PromptOK("OK");


All these little detail can be found in documentation Wink

Best regards,
Honza
Re: ArrayMap<String,TabCtrl::Item> - check if String exists.. [message #34357 is a reply to message #34356] Fri, 18 November 2011 12:39 Go to previous messageGo to next message
Wolfgang is currently offline  Wolfgang
Messages: 146
Registered: November 2011
Location: Germany
Experienced Member
Thank you, I just searched in the ArrayMap and couldn't find a entry.
Re: ArrayMap<String,TabCtrl::Item> - check if String exists.. [message #34359 is a reply to message #34357] Fri, 18 November 2011 14:04 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Wolfgang wrote on Fri, 18 November 2011 12:39

Thank you, I just searched in the ArrayMap and couldn't find a entry.

Some of the functionality that is common to more classes is often implemented in base classes. E.g. AString is a base to both String and WString, and AMap is base for ArrayMap and VerctorMap. So when searching for help you usually want to read those too.

Honza
Previous Topic: New and GUI Problem with TabCtrl
Next Topic: What Type to give a Layout as parameter?
Goto Forum:
  


Current Time: Fri Mar 29 12:35:15 CET 2024

Total time taken to generate the page: 0.01077 seconds