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 » Problem in example code (Tried SplitterFrame yet minor problem.)
Re: Problem in example code [message #45950 is a reply to message #45946] Sat, 30 January 2016 16:37 Go to previous messageGo to previous message
vegaonline is currently offline  vegaonline
Messages: 35
Registered: December 2015
Location: Mumbai, India
Member

dolik.rce wrote on Sat, 30 January 2016 14:03
Hi,

I'm still not sure it is really good idea to this dynamically, but here is a working method:
	void StoreToJson() {
		Json json;
		for (Ctrl *q = GetFirstChild(); q; q=q->GetNext()) {
			if (dynamic_cast<EditField *> (q)) {
				String id = q->GetLayoutId();
				if (id.GetCount())
					json(id, ~*q);
			}
		}
		SelectFileOut out("*.*");
		if (out.IsOpen())
			out << json << "\n";
	}

It is actually almost the same as the code you posted. Full code is in the attached archive. Just click anywhere in the window to trigger the save as dialog. I'm not sure why it didn't work for you. Only thing I can think of is that you didn't assign names to the editfields in the layout.

Honza


Dear Honza,

Thanks a lot. Your technique for SelectFileOut is working and one file is created while the content is "{}". It means json content was not made. Probably you are right that dynamic_cast is not working. EditFields have dedicated names. Here "if (dynamic_cast<EditField *> (q)) { " is not true.

Is there any other way to bypass dynamic_cast?

best
Abhi
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Issues using 2015.2 version
Next Topic: How to build FREBSD *.so in Windows?
Goto Forum:
  


Current Time: Thu May 09 17:57:55 CEST 2024

Total time taken to generate the page: 0.02334 seconds