Home » Community » Newbie corner » Problem in example code (Tried SplitterFrame yet minor problem.)
Re: Problem in example code [message #45957 is a reply to message #45951] |
Sun, 31 January 2016 15:09   |
|
dolik.rce wrote on Sat, 30 January 2016 21:39vegaonline wrote on Sat, 30 January 2016 16:37Probably you are right that dynamic_cast is not working. EditFields have dedicated names. Here "if (dynamic_cast<EditField *> (q)) { " is not true.
The dynamic_cast actually works correctly in the test application I attached in my previous post. Are you calling this function on the correct Ctrl? GetFirstChild iterates over Ctrls added directly to the one you are calling the function on. You can try to add DUMP(typeid(*q).name()) before the dynamic_cast condition to see the types over which you actually iterate to make sure it is really those that you want to save. Note that it will log mangled names, but they should still be readable, e.g. "N3Upp10EditMinMaxIiNS_10ConvertIntEEE" stands for Upp::EditMinMax<ConvertInt> which is just typedefed EditInt.
If you still speak about the application using ParentCtrls to switch layouts, I guess you just iterate over the ParentCtrl. You'll have to either a) call it on the actual layout (i.e. something like "for (Ctrl* q = doPlt->GetFirstChild(); ...") or b) iterate recursively over the controls to save all the Ctrls even when they lower layers of the hierarchy tree).
Honza
Dear Honza,
Thanks for your hints. The example you sent worked well in its capacity. In my case the DUMP reported
* /home/vega/upp.out/MyApps/GCC.Debug.Debug_Full.Gui.Shared/Flasher 31.01.2016 19:48:23, user: vega
{}
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp6ButtonE
typeid(*q).name() = N3Upp6ButtonE
typeid(*q).name() = N3Upp6ButtonE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp9EditFieldE
typeid(*q).name() = N3Upp5LabelE
typeid(*q).name() = N3Upp9EditFieldE
json = {"projTitle":"testing","eventNum":"979817974","nPerGen":"12","zVal":"11","inactN":"1","actN":"1","wCutoff":"0.009","massNo":"221","KEMeV":"12","beamX":"0","beamY":"0","beamZ":"0","cosTheta":"1","sinPhi":"0","cosPhi":"1"}
So Your guess is perfect that I was iterating over ParentCtrl.
Your advice for properly using Ctrl was also OK as I used
for (Ctrl *q = doCard.GetFirstChild(); q; q=q->GetNext()) {..}
I GOT SAVED FILE. THANKS
***** Actually, I have a card Layout and I want to fill different forms like EditField, EditInt etc and like to save only values in the forms to some text file so that another code will read it as input parameter and run. I thought to use json. However, is there any other simpler way to save only the values in those edit fields?
By the by, you are perfect to be a good TEACHER. I am grateful to you for answering an weak student like me.
Best
Abhijit
[Updated on: Sun, 31 January 2016 15:38] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun May 04 22:23:08 CEST 2025
Total time taken to generate the page: 0.03287 seconds
|