Page 2 of 3

Re: New install Cannot select virtual folder

Posted: Thu Mar 22, 2018 8:08 pm
by philjynx
Dunno what pastbining is, but here is this current experiment.

It might be important to point out that

Code: Select all

this->SetFont( wxFont( 32, 74, 90, 90, false, wxT("Sans") ) ); 

Is the only line in my derived constructor.

Re: New install Cannot select virtual folder

Posted: Thu Mar 22, 2018 8:41 pm
by DavidGH
Hmm. Looking at the resulting code after changing the font in wxC, there's no change in the C++ code. However it is there in the XRC code.
Explanation: XRC is an xml-like language that wx programs can optionally use to create the gui. I use it in my program, and wxCrafter uses it internally to produce the preview. So that's why you can see the change in wxC, but it's not in the generated C++; which sounds like a bug.

I tried adding it by hand. Putting it at the beginning of the baseclass ctor worked as expected. However putting it at the end had no effect; presumably because the child controls' fonts were already set at that stage. Putting it in the derived class failed, presumably because the baseclass ctor had already run.

I can't think of a quick and non-kludgy fix for that, short of switching to XRC for your gui creation. If you want to try, it's not hard. Start by looking at the wx 'xrcdemo' sample or, simpler, create a new CodeLite Project from the 'executable (wxWidgets + XRC)' template.

Re: New install Cannot select virtual folder

Posted: Thu Mar 22, 2018 9:03 pm
by philjynx
I imagine that putting it in the derived class constructor, is, effectively, putting it at the end of the base constructor...

Re: New install Cannot select virtual folder

Posted: Thu Mar 22, 2018 9:22 pm
by philjynx
Ok, made a new one as you suggested, and it builds and does the fonts.
But, I can't find any generated code for the event I added to a button.

This sort of thing:

Code: Select all

void MainFrame::OnClose(wxCommandEvent& event)
{
    Close(true);
}
That was the empty code that wxCrafter generated when it was a c++ project. I added the Close(true) to it.
So, although your alternative approach produces the desired appearance, how do I get access to events and such like?

Er, and what sample? Where?

Re: New install Cannot select virtual folder

Posted: Thu Mar 22, 2018 10:22 pm
by DavidGH
I don't think XRC does events. Certainly I never have used it for them, and wxC doesn't generate any XRC for them.

If you don't want to do the Connect() or Bind() by hand, you can copy/paste the event things from the C++ generated code. You don't actually have to generate C++, just look in the C++ tab (next to the Designer tab). you can copy code from there to your derived class so that it doesn't get overwritten.
Er, and what sample? Where?
One of the samples that come with the wxWidgets source. wxsourcedir/samples/xrc/

Re: New install Cannot select virtual folder

Posted: Thu Mar 22, 2018 10:28 pm
by philjynx
DavidGH wrote: One of the samples that come with the wxWidgets source. wxsourcedir/samples/xrc/
Ah, right thanks.

Re: New install Cannot select virtual folder

Posted: Thu Mar 22, 2018 10:52 pm
by philjynx
Of course, I have no idea where that source is on my machine.
Flawed though it is using wxFormBuilder, I can at least produce some semblance of the appearance that I want with it.
I can't get codelite to integrate with formbuilder, so I'll just have to run it in tandem (which is what I had to do with Atom in anycase).
So, I get a better editor/IDE with codelite, but I haven't the time to chase this with wxcrafter.
Thanks for your help.

Re: New install Cannot select virtual folder

Posted: Fri Mar 23, 2018 12:43 am
by philjynx
Remember Columbo (the detective) well, I'm gonna do a Columbo here!
Wish one of us had thought of setting the font size on each individual control, it doesn't take long and it gets the job done.
This means I can use codelite and wxcrafter with c++ not xrc which I couldn't cope with
Yay!
Thanks David - you've been very patient and helpful - it's clear you're in a different programming league to me.
Cheers.

I have a question:
Is there an easy way of getting round the problem that the path in the makefile is (of course! :D ) non-existent on my RPi so the build fails spectacularly there. I've tried to make a matching path, but VNC doesn't seem to be allowed to write there (that's how I move my files around).

Re: New install Cannot select virtual folder

Posted: Fri Mar 23, 2018 12:58 am
by philjynx
Update
Is there an easy way of getting round the problem that the path in the makefile is (of course! :D ) non-existent on my RPi so the build fails spectacularly there. I've tried to make a matching path, but VNC doesn't seem to be allowed to write there (that's how I move my files around).
I figured out how to change the owner on the newly created path structure.
VNC was then able to copy accross and to my amazement, it built and ran nicely.

Nice!

Thanks again.

Re: [SOLVED] New install Cannot select virtual folder

Posted: Fri Mar 23, 2018 2:11 am
by DavidGH
it's clear you're in a different programming league to me.
Not really. I'm a not-particularly-talented amateur. However I've been using wx for so long now that I know my way around much of it.
Wish one of us had thought of setting the font size on each individual control, it doesn't take long and it gets the job done.
I'd presumed that, in reality, you were going to have far more controls, so setting a font for each would be tedious. Though, having said that, with a RAD it wouldn't have been a major issue.

Anyway, I'm glad it's now working.