Code: Select all
#include <gtkInterface.H>
#include <Labels.H>
#include <Box.H>
int main(int argc, char *argv[]){
gtk_init( &argc, &argv ); // init GTK
GtkInterface topWindow; // Create the top box
Labels labs, labs2; // Instantiate the Labels class
labs<<"Hello world !"<<"You are programming me"<<"thank you";
labs2<<"I feel"<<"alive!";
VBox vBox, vBox2; // Instantiate the two vertical packing box variables
vBox<<labs; // Load the labels into the box
vBox2<<labs2; // Load the labels into the second box
HBox hBox; // Instantiate the vertical packing box class
hBox<<vBox.show()<<vBox2.show(); // Load the labels into the box
topWindow<<hBox.show(); // Show the box and load the box into the GtkInterface
gtk_main(); // run GTK+
}
Code: Select all
Labels labs, labs2;
labs<<"Hello world !"<<"You are programming me"<<"thank you";
labs2<<"I feel"<<"alive!";
Code: Select all
VBox vBox, vBox2;
vBox<<labs;
vBox2<<labs2;
Code: Select all
HBox hBox;
Code: Select all
HBox hBox;
hBox<<vBox.show()<<vBox2.show();
Code: Select all
topWindow<<hBox.show();
Code: Select all
g++ BoxesInBoxesPacking.C -o BoxesInBoxesPacking `pkg-config gtk+-2.0 --cflags --libs` -Igtkiostream-1.5.0/include
Code: Select all
#include <gtkInterface.H>
#include <Labels.H>
#include <Box.H>
int main(int argc, char *argv[]){
gtk_init( &argc, &argv ); // init GTK
GtkInterface topWindow; // Create the top box
Labels labs, labs2; // Instantiate the Labels class
labs<<"Hello world !"<<"You are programming me"<<"thank you";
labs2<<"I feel"<<"alive!";
VBox vBox, vBox2; // Instantiate the two vertical packing box variables
vBox<<labs; // Load the labels into the box
vBox2<<labs2; // Load the labels into the second box
HBox hBox; // Instantiate the vertical packing box class
hBox<<vBox.show()<<vBox2.show(); // Load the labels into the box
topWindow<<hBox.show(); // Show the box and load the box into the GtkInterface
gtk_main(); // run GTK+
}
Code: Select all
VBox vBox, vBox2; // Instantiate the two vertical packing box variables
vBox.reset();
vBox2.reset();
vBox<<labs; // Load the labels into the box
vBox2<<labs2; // Load the labels into the second box
HBox hBox; // Instantiate the vertical packing box class
hBox.reset();
hBox<<vBox.show()<<vBox2.show(); // Load the labels into the box
Code: Select all
DragNDrop &operator<<(Widget &w){
setUserData(&w);
}
Code: Select all
BoxIS(void) {
setDefaults(); // load up the default values
}
Code: Select all
BoxIS(void) {
setDefaults(); // load up the default values
expand = expandDefault;
fill = fillDefault;
start = startDefault;
}
As I said, it won't be exactly how it was shown as those example images are with the values in a random state (which makes me wonder how it wasn't noticed by flatmax as they clearly aren't how the default state suggests). On my PC in the random state it has the 3 liner on the left all together but the 2 liner spread out. It would also change depending on what optimisation level you compile with.1dot0 wrote:hi,
thank you very much!
I made the changes as you suggested, and it looks much better, the labels are now in the correct order.
Nonetheless still the labels are very close to each other, all at the top, so the look is still quite different from here:
thanks again,Paeryn wrote: As I said, it won't be exactly how it was shown as those example images are with the values in a random state (which makes me wonder how it wasn't noticed by flatmax as they clearly aren't how the default state suggests). On my PC in the random state it has the 3 liner on the left all together but the 2 liner spread out. It would also change depending on what optimisation level you compile with.
Code: Select all
VBox vBox, vBox2; // Instantiate the two vertical packing box variables
// Pass Box::EXPAND and Box::FILL to set the current fill and expand states to true
vBox << Box::EXPAND << Box::FILL << labs; // Load the labels into the box
vBox2 << Box::EXPAND << Box::FILL << labs2; // Load the labels into the second box
HBox hBox; // Instantiate the vertical packing box class
hBox.setDefaultExpand(true); // Set default and current expand to true
hBox.setDefaultFill(true); // Set default and current fill to true
hBox << vBox.show()<<vBox2.show(); // Load the labels into the box
Code: Select all
Box::
Code: Select all
Box.
Yes, it didn't need them in the other one (Tut 6) as EXPAND and FILL were used inside the class and so already in scope. In this case they are outside the class so you have to provide the scope. Just had a thought... Yes, you can or the two values together when using output streams, to all intents and purposes they do the same (one function call instead of two, but with optimisations on it will produce the same code and eliminate both function calls).1dot0 wrote:aah, thanks again!
all thosethings was what a was missing!Code: Select all
Box::
My Pi is now shut down, I'll test tomorrow ASAP!
BTW, interesting that it's notinstead, but I won't worry about that detailCode: Select all
Box.
Code: Select all
// These two are equivalent
vBox << Box::EXPAND << Box::FILL << label;
vBox << (Box::EXPAND|Box::FILL) << label;
Code: Select all
void setDefaults(void){
expandDefault=fillDefault=false; //defaultVal; // setup the default beh\
aviour
startDefault=true;//!defaultVal;
expand = expandDefault;
fill = fillDefault;
start = startDefault;
}
Make flatmax's change and undo mine. Basically move those three lines from where I put them (in BoxIS(void)) and put them in setDefaults(void). I wasn't sure if setDefaults() was meant to set them or if it was only meant to set the default values.1dot0 wrote:hi,
are there now any further changes to what Paeryn already changed in the Box .h or .c file, or is this now an additional change, and/or do I have to update / download any .h file addtionally?
In the file you had to alter previously (gtkiostream-1.5.0/include/Box.H) the function you need to put the lines in is a few lines above where you put them originally.1dot0 wrote:where exactly do I find the code snippet where I have to make the changes?
Yes, part of class BoxIS in Box.H1dot0 wrote:it was Box.H, correct?
in class BoxIS?
but I can't find the lines any more, it'as all accidentally overwritten unfortunately -
can I please get the whole code, not just the snippet?
The files aren't in the repositories or git, they are in an archive file you download from sourceforge. You must have downloaded it previously. You can easily transfer the file to the rpi with a USB stick / memory card. At a push you could use the rpi's sd card (there should be enough room on the boot partition to temporarily copy it to). There are programs for Windows that can open the archive if you want to get at just one file (I'm sure 7zip can handle it).1dot0 wrote:I have only internet on my windows PC, the internet on my pi is a torture.
I can only reload it by apt-get install or git clone or the whole installation procedure on my Pi - is it that what you mean, complete re-install?