Good Evening
I have recently begun looking into the feasibility of using the AGAR
library to work with x-windows under Linux Mint (19.3). I have made and
installed AGAR 1.6.0 without problems. Looking at the examples in the tests
directory plus the online documentation it all looks fairly
straightforward.
I am having a problem with radio buttons. Hence, I think there must be
something I am not understanding. I will include some code below, however,
firstly I will explain what I am trying to achieve.
I create a window of a certain size (300x400). I divide the window
vertically into two panes. The upper pane will have a series of 4 radio
buttons; the lower pane a notebook with two pages.
I have an array of 4 text strings that I use as labels on the radio
buttons. I would like the 4 radio buttons aligned horizontally and filling
the x-direction. I can get them aligned horizontally, however, I cannot get
them to fill the available space in the x-direction. I have tried both
placing them in a horizontal box and not. It makes no difference.
The code is below. Please note that it is minimal. There are other items
that will be displayed within other horizontal and vertical panes and
divisions. I have simply deleted that code as it is extraneous to this test.
Any thoughts/suggestions would be most appreciated.
regards
Stephen Meatheringham
Canberra, Australia
///////////////////////////////////////////////////////////////////////////
#include <agar/core.h>
#include <agar/gui.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int i;
AG_Window *win;
char *driver = NULL;
AG_Pane *vPane;
AG_Box *hBox, *div;
AG_Notebook *nb;
AG_NotebookTab *nt;
AG_Radio *rad;
if (AG_InitCore(NULL, 0) == -1 || AG_InitGraphics(driver) == -1)
return (1);
AG_BindStdGlobalKeys();
win = AG_WindowNew(AG_WINDOW_MAIN);
AG_WindowSetGeometry(win, 100, 100, 300, 400);
// Divide the window into two panes
vPane = AG_PaneNewVert(win, AG_PANE_UNMOVABLE | AG_PANE_HFILL);
div = vPane->div[0];
// In the upper pane
// Create a horizontal box
// Add 4 radio buttons, horizontally-oriented and filling the x-direction
hBox = AG_BoxNewHoriz(div, AG_BOX_HOMOGENOUS | AG_BOX_HFILL);
const char *radioItems[] = {
"String1", "String2", "String3", "String4", NULL };
rad = AG_RadioNewFn(hBox, AG_RADIO_HFILL, NULL, AGWINDETACH(win));
AG_RadioSetDisposition(rad, AG_RADIO_HORIZ);
AG_RadioItemsFromArray(rad, radioItems);
// In the lower pane
// Create a notebook with two pages in the bottom section of the window
nb = AG_NotebookNew(vPane->div[1], AG_NOTEBOOK_EXPAND);
nt = AG_NotebookAdd(nb, "Some text", AG_BOX_VERT);
nt = AG_NotebookAdd(nb, "Empty tab", AG_BOX_VERT);
AG_NotebookSelect(nb, nt);
AG_WindowShow(win);
AG_EventLoop();
return (0);
}
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html