Manually position widgets in a gui


ROOT Version: 6.18/04
Platform: Ubuntu 18.04
Compiler: gcc 7.5.0 (Ubuntu 7.5.0-3)


I’m building a GUI and it turned out that I need add an extra TGCheckButton. I already have another check button so I wanted to place the new one on top of that, i.e. in the red square on the following image.

I used several option such as kLHintsRight | kLHintsBottom or kLHintsRight | kLHintsTop but it’s not possible to have the 2 check button one on top of the other. Any idea on how to do that?

The following snippet of code is how I build this part of the GUI.
Thanks in advance for your help!

//___________________________________________________________________________________________________________________________________DRAW_SIGNAL
    // A grouped frame with drawing controls
    fr_draw = new TGGroupFrame(fr_left, "Draw", kChildFrame | kHorizontalFrame);
   
        // A button to draw the signal - uses Draw(“line point”) TGOption
        but_draw_line_points = new TGPictureButton(fr_draw, gClient->GetPicture("../icons/Draw.ico"), 11);
        // A button to draw the next event
        but_draw_next_event = new TGPictureButton(fr_draw, gClient->GetPicture("../icons/Next_event.ico"), 11);

        // A button to draw the previous event
        but_draw_previous_event = new TGPictureButton(fr_draw, gClient->GetPicture("../icons/Previous_event.ico"), 11);

	    // A check-button to select previous/next event for a given detector
	    but_draw_same_detector = new TGCheckButton(fr_draw, "Same detector",0);
	    
	    // A check-button to draw dual-trace
	    but_draw_dual_trace = new TGCheckButton(fr_draw, "Dual trace", 0);

        // Add everything to the grouped frame
        fr_draw->AddFrame(but_draw_line_points   , new TGLayoutHints(kLHintsLeft | kLHintsBottom | kFitHeight, 2, 2, 10, 0) );
        fr_draw->AddFrame(but_draw_previous_event, new TGLayoutHints(kLHintsCenterX | kLHintsBottom | kFitHeight, 2, 2, 10, 0) );
        fr_draw->AddFrame(but_draw_next_event    , new TGLayoutHints(kLHintsCenterX | kLHintsBottom | kFitHeight, 2, 2, 10, 0) );
        fr_draw->AddFrame(but_draw_dual_trace    , new TGLayoutHints(kLHintsRight | kLHintsBottom | kFitHeight, 2, 2, 10, 0) );
        fr_draw->AddFrame(but_draw_same_detector , new TGLayoutHints(kLHintsRight | kLHintsTop | kFitHeight, 2, 2, 10, 0) );
   
 // Add the grouped frame to the vertical one
    fr_left->AddFrame(fr_draw, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));

If you add all your widgets in a single horizontal frame, they will be horizontally aligned… You need to add a vertical frame as container for your two TGCheckButton, so they will be on top of each other