IPB SourceForge.net Logo

Welcome Guest ( Log In | Register )

[ Outline ] · Standard · Linear+

> Compiling with CodeBlocks?, Is it my stupidness or a bug? ;)

frozen
post Sep 22 2006, 08:28 AM
Post #1


Member
**

Group: Members
Posts: 11
Joined: 22-September 06
Member No.: 428



Hi there!

I want to start programming GUI-programs. After a lot of searching I decided to try VCF although it currently doesn't seem to have a linux version available. I saw that this is being worked on, so it's not a showstopper. I just want something free being able to run on windows, linux and mac systems..
Most other available GUI-Toolkits looked very complicated to me.. Downloading and compiling dozens of different libraries seems a pain to me..

So I found VCF and thought: Wow! This looks great! But why the §$%$%& are no binarys available??? Ok, no problem, I'll compile them myself.. Codeblocks seems to be supported, even easily.. It says: "Open AllProjects Workspace and build the workspace".. Great! Thats easy! Thats what I thought...

I downloaded VCFSrcOnlyInstaller-0.9.0.exe, started it, disables everything that looked like VC and after short time it was installed.. Great! Changing to this directory, opening the vcfAllProjects.workspace, clicking "Build workspace" - and dozens of errormessages... All complaining about files not found...

..\..\..\src\vcf\FoundationKit\FoundationKit.h:82: vcf/FoundationKit/VCF.h: No such file or directory

49 others follow..

Ok, path not set? Nope, it was set..
Error in the build options? None obvious for me.. I tried adding the path to the include directory myself in case the environment variable might not be resolved but to no avail..
I tried the following path:
J:\Programme\VCF-0.9.0\
edit: J:\Programme\VCF-0.9.0\src\ also didn't work.. That's so frustrating...

I hope someone can give me a hint.. I guess it's rather my fault..

Additional information:
Code::Blocks version is 1.0 revision 2796
Operating system is w2k

frozen
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topicStart Poll
Replies
Fraggle
post Sep 22 2006, 05:35 PM
Post #2


Advanced Member
***

Group: Members
Posts: 518
Joined: 6-December 04
Member No.: 112



Yeah, the docs encourage you to use a nightly rather than RC2 because, well, the nightlies are just miles better! They work better too...

Feel free to ask stupid questions (especially if you can't find the answer in the docs or don't understand the docs), so the documentation can be improved so the next noob has an easier time! smile.gif


--------------------
FLAGRANT SYSTEM ERROR
Computer Over.
Virus = Very Yes.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
frozen
post Sep 24 2006, 12:47 PM
Post #3


Member
**

Group: Members
Posts: 11
Joined: 22-September 06
Member No.: 428



QUOTE(Fraggle @ Sep 22 2006, 07:35 PM)

Feel free to ask stupid questions (especially if you can't find the answer in the docs or don't understand the docs), so the documentation can be improved so the next noob has an easier time! smile.gif
*



biggrin.gif That's what I thought...

My very first (stupid?) question:

Please look at this code:

CODE

Panel* panel = new Panel();
panel->setBounds(&mainWindowBounds);

Container* container = panel->getContainer();
if ( NULL != container ) {
   Label* label = new Label();
   label->setCaption("Testtext");
   container->add( label );
   }

mainWindow->add(panel, AlignBottom);


I took it from the documentation and changed it a little bit. It's listed in the doc in 3.3.8.1
I inserted the shown code below line 88 of helloworld2.cpp but it doesn't show the labeltext..

panel->setBounds(&mainWindowBounds); was inserted, because without this, it would only show small signs that the panel indeed was inserted, but it was very very small, maybe 1 px or so..

Commenting out the if and replacing the container->add( label ); with mainWindow->add( label ); works though, at least the label is shown..

So I suppose something is wrong with the container?

BTW, is VCFBuilder available as binary somewhere? It would even compile it, but it seems, Code::Blocks is not supported.. Dev-cpp isn't too.. And thats all IDEs I can use to compile...

Thanks for your help!

frozen
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
vortic
post Sep 24 2006, 03:51 PM
Post #4


Advanced Member
***

Group: Members
Posts: 1026
Joined: 13-April 04
Member No.: 42



QUOTE(frozen @ Sep 24 2006, 07:47 AM)
CODE

Panel* panel = new Panel();
panel->setBounds(&mainWindowBounds);

Container* container = panel->getContainer();
if ( NULL != container ) {
   Label* label = new Label();
   label->setCaption("Testtext");
   container->add( label );
   }

mainWindow->add(panel, AlignBottom);

*



You have not specified a size for your label, therefore it has a size of 0, or maybe just 1 pixel as you say for your Panel. The discussion below applies to a Panel as well, or any other visible Control.

You can either spcify its width, height, both width and height, or when you add the label to the Panel, specify AlignClient for alignment.

If you add a control with AlignBottom or AlignTop alignment, you need to specify the height of the Control you are adding.

If you add a control with AlignRight or AlignLeft alignment, you need to specify the width of the Control you are adding.

If you add a control with AlignClient alignment, you don't need to specify any size of the control you are adding, because it will be automatically resized to take up any available space on the container you are adding it to.

As some examples:


CODE
if ( NULL != container ) {
 Label* label = new Label();
 label->setCaption("Testtext");
 container->add( label, AlignClient );
}


or

CODE
if ( NULL != container ) {
 Label* label = new Label();
 label->setCaption("Testtext");
 label->setHeight( 40.0 );
 container->add( label, AlignBottom );
}


or

CODE
if ( NULL != container ) {
 Label* label = new Label();
 label->setCaption("Testtext");
 label->setBounds( 40, 40, 80, 100 );
 container->add( label );
}
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
frozen
post Sep 24 2006, 05:08 PM
Post #5


Member
**

Group: Members
Posts: 11
Joined: 22-September 06
Member No.: 428



Thanks, this does the job.. Rather not too intuitive, at least for me...

Is it somehow possible, to find out, what size is needed, so that the whole content fits in?

For example if the labels caption is "1" it should have a width and height (size) fitting just this character and if it has the caption "The number is: 1" it should have a much larger width so that the whole text fits.. Something like label->setBounds(label->getNeededSize()); ?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
vortic
post Sep 24 2006, 11:36 PM
Post #6


Advanced Member
***

Group: Members
Posts: 1026
Joined: 13-April 04
Member No.: 42



QUOTE(frozen @ Sep 24 2006, 12:08 PM)
Is it somehow possible, to find out, what size is needed, so that the whole content fits in?
*



Yes. You need access to a GraphicsContext, and I *think* you want the GraphicsContext onto which the Label is being painted. I'm not sure where your code above is at, but if it is in your MainWindow constructor:

CODE
if ( NULL != container ) {
 Label* label = new Label();
 label->setCaption(L"Testtext");

 GraphicsContext* ctx = this->getContext();  
 label->setBounds( 40, 40, ctx->getTextWidth( L"Testtext" ), 100 );
 
 container->add( label );
}



To make sure it is actually making the Label the correct width, try it with this code, which paints the background of the Label an orange color.

CODE
if ( NULL != container ) {
 Label* label = new Label();
 label->setCaption(L"Testtext");

 GraphicsContext* ctx = this->getContext();  
 label->setBounds( 40, 40, ctx->getTextWidth( L"Testtext" ), 100 );

 label->setTransparent( false );
 //label->setUseColorForBackground( true );//EDIT: This call is not needed.
 label->setColor( Color::getColor("orange"));
 
 container->add( label );
}
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
vortic
post Sep 25 2006, 12:04 AM
Post #7


Advanced Member
***

Group: Members
Posts: 1026
Joined: 13-April 04
Member No.: 42



QUOTE(vortic @ Sep 24 2006, 06:36 PM)
QUOTE(frozen @ Sep 24 2006, 12:08 PM)
Is it somehow possible, to find out, what size is needed, so that the whole content fits in?
*



Yes. You need access to a GraphicsContext, and I *think* you want the GraphicsContext onto which the Label is being painted.


I'm not sure, but you probably want the GraphicsContext of the Label itself. So, replace this->getContext() with label->getContext();

If you are going to use anything but the default font and size for your text, set that before you set the Bounds, and it might work.

Maybe ddiego can comment on that.


Edit:
Ok, so I tried with a non-default font to see. You need to set the GraphicsContext instance currentFont_ member first if you use a non-default font. I tried with a 24pt Arial font like so:

QUOTE
if ( NULL != container ) {
  Label* label = new Label();
  label->setCaption(L"Testtext");

  Font myFont( "Arial", 24 );
  label->setFont( &myFont );

  GraphicsContext* ctx = label->getContext();
  ctx->setCurrentFont( &myFont );
 
  label->setBounds( 40, 40, ctx->getTextWidth( L"Testtext" ), ctx->getTextHeight( L"Testtext" ) );

  label->setTransparent( false ); 
  label->setColor( Color::getColor("orange"));
 
  container->add( label );
}
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
frozen
post Sep 25 2006, 10:35 AM
Post #8


Member
**

Group: Members
Posts: 11
Joined: 22-September 06
Member No.: 428



QUOTE(vortic @ Sep 25 2006, 02:04 AM)
Ok, so I tried with a non-default font to see. You need to set the GraphicsContext instance currentFont_ member first if you use a non-default font. I tried with a 24pt Arial font like so:


Thank you very much! This fits best to my intention.
Windows allows the selection of different schemes how things are shown. I don't know how it is called exactly in english Windows systems, I guess it's something like "Windows classic (extralarge)" or so. If a user (with bad eyes maybe) selects this extralarge theme I was afraid all my GUIs might not be readable at all because of overlapping controls. The example where you can select these themes shows what I mean. I want my program to be able to react on such themes by changing the size of the controls so that everything stays readable.

If there was an even easier way to do this, this would be great..

Maybe I should post other questions as a new thread? I guess the information from this one might be interesting for others too..

Again: Thank you very much!!

frozen
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic
frozen   Compiling with CodeBlocks?   Sep 22 2006, 08:28 AM
frozen   This problem seems to be solved.. It's compili...   Sep 22 2006, 10:53 AM
vortic   Code::Blocks version is 1.0 revision 2877 (Aug. ...   Sep 22 2006, 11:44 AM
frozen   Thats where I am now.. Since it did work now (wh...   Sep 22 2006, 12:42 PM
vortic   Thats where I am now.. [/quote] Yeah, that is...   Sep 22 2006, 01:05 PM
Fraggle   Yeah, the docs encourage you to use a nightly rath...   Sep 22 2006, 05:35 PM
frozen   :D That's what I thought... My very first...   Sep 24 2006, 12:47 PM
vortic   You have not specified a size for your label, th...   Sep 24 2006, 03:51 PM
frozen   Thanks, this does the job.. Rather not too intuiti...   Sep 24 2006, 05:08 PM
vortic   Yes. You need access to a GraphicsContext, and I...   Sep 24 2006, 11:36 PM
vortic   Yes. You need access to a GraphicsContext, and I...   Sep 25 2006, 12:04 AM
frozen   Thank you very much! This fits best to my in...   Sep 25 2006, 10:35 AM
ddiego   Yeah, that would definitely make it easier to fi...   Sep 26 2006, 01:39 PM
ddiego   What might make sense is to have some optional con...   Sep 26 2006, 01:42 PM
frozen   Sounds great! When will this be ready? ;) I...   Sep 26 2006, 02:14 PM
Fraggle   Could you give an example of where that would be...   Sep 24 2006, 09:07 PM
keenblade   Hi, This is the same for me. I can't build V...   Nov 14 2006, 02:57 AM
vortic   Hi, I feel your pain! I just tried with ...   Nov 15 2006, 04:29 AM
vortic   To quote the title of the thread "Compilin...   Nov 15 2006, 11:09 PM
frozen   This was what helped me. Environment variables w...   Nov 16 2006, 07:14 AM
keenblade   This was what helped me. Environment variables w...   Nov 16 2006, 09:35 PM
keenblade   ApplicationKit_mgcc.dll FoundationKit_mgcc.dll Gra...   Nov 20 2006, 01:16 AM
kdmix   I've just built VCF (r2951) with mingw using ...   Nov 20 2006, 08:20 PM
vortic   [snapback]7166 kdmix, Did you build the Diction...   Nov 21 2006, 12:24 AM
vortic   Oops. Sorry Fraggle :) Is the problem in the ...   Nov 21 2006, 12:52 AM
keenblade   Yes, the problem is in the Dictionaries example i...   Nov 21 2006, 04:09 AM
vortic   HelloWorld works fine for me. The other 2 are br...   Nov 21 2006, 05:48 AM
keenblade   I can't build the libs anymore with the VCF s...   Nov 21 2006, 07:09 PM
ddiego   I just glanced at the log and it seemed to indic...   Nov 21 2006, 07:14 PM
keenblade   If you look at the previous 3 lines it says proce...   Nov 21 2006, 07:25 PM
ddiego   If you look at the previous 3 lines it says proce...   Nov 21 2006, 07:35 PM
keenblade   Is it possible that I have the most recent sdk an...   Nov 21 2006, 07:48 PM
ddiego   Is it possible that I have the most recent sdk an...   Nov 21 2006, 07:54 PM
keenblade   Thanks for the suggestion. I am a little bit Gnu ...   Nov 21 2006, 08:12 PM
kdmix   As I can see the problem looks like this mgcc...   Nov 21 2006, 07:45 PM
vortic   Well crud. I updated to the new api and runtime ...   Nov 21 2006, 11:24 PM
keenblade   Since api ver:3.7 works fine and the richole.h i...   Nov 24 2006, 02:54 AM
vortic   Well, I don't know what causes the linker er...   Dec 19 2006, 02:22 AM
ddiego   Wow! :blink: That's bizzarre - I would ...   Dec 19 2006, 01:40 PM
vortic   Well, of course, that is the first thing one think...   Dec 20 2006, 12:08 AM
vortic   Well, I don't know what causes the linker er...   Jan 3 2007, 06:30 AM
the-golem   I encountered this error also. I simply downloade...   Feb 26 2007, 04:01 AM
vortic   That is not exactly what the code is in svn. You...   Feb 26 2007, 07:29 PM
the-golem   That is not exactly what the code is in svn. You...   Feb 26 2007, 09:36 PM
Fraggle   Are you using the installer? If not, you will need...   Nov 14 2006, 08:02 PM


Reply to this topicTopic OptionsStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
 

Lo-fi Version : 19th May 2013 - 10:42 AM