Hi Guys,

I hit some setbacks recently while playing with list control and split box.

The idea was very simple. I put two list controls in a splitbox so I can
use split bar the adjust the ratio of each control, while both have
scrollbars to view their contents.

The problem was the list control didn't pick up the size change of its
container. Therefore the scrollbar didn't show up, or sometimes just showed
the vertical scroll bar. Though I've already specified
IupSetAttribute(bt, "SCROLLBAR", "YES");
in my program.

I tried them with vbox and the result was the same. So it's not problem of
splitbox, just the list control. I modified the split.c in the IUP examples
package to demonstrate the effect, please kindly find the attachment. It
was built in Debian 8 32bit with libgtk2, though there were other issues
appeared with libgtk3.

It looks I need to build up some knowledge about the resize process in the
IUP runtime system. Could you guys show me some hints, docs, knowedge base
and anything are welcome please?

By the way there are some size dismatch warnings in iup_image.c while type
converting from pointer to integer in 64bit gcc. Currently I changed
it  from pointer to long. But I think it should be easily removed in future
IUP releases.

Kind regards
Andy
#include <stdio.h>
#include <iup.h>

static char	*setlist[] = {
	"IUP is a multi-platform toolkit for building graphical user interfaces.",
	"It offers a simple API in three basic languages: C, Lua and LED.",
	"IUP's purpose is to allow a program source code to be compiled",
	"in different systems",
	"without any modification.",
	"Its main advantages are:",
	"high performance,",
	"due to the fact that it uses native interface elements.",
	"fast learning by the user, due to the simplicity of its API.",
	"This work was developed at Tecgraf/PUC-Rio by means of the partnership with PETROBRAS/CENPES.",
	NULL
};

void SplitTest(void)
{
  Ihandle *dlg, *bt, *split, *ml, *vbox;
  int	i;

#if 0
  bt = IupButton("Button", NULL);
  IupSetAttribute(bt, "EXPAND", "YES");
#else
  bt = IupList(NULL);
  for (i = 0; setlist[i]; i++) {
    IupSetStrAttributeId(bt, "", i+1, setlist[i]);
  }
  IupSetAttribute(bt, "EXPAND", "YES");
  IupSetAttribute(bt, "MULTIPLE", "YES");
  IupSetAttribute(bt, "SCROLLBAR", "YES");
  IupSetAttribute(bt, "ALIGNMENT", "ARIGHT");
  IupSetAttribute(bt, "CANFOCUS", "YES");
#endif

  ml = IupMultiLine(NULL);
  IupSetAttribute(ml, "EXPAND", "YES");
  IupSetAttribute(ml, "SCROLLBAR", "YES");
  IupSetAttribute(ml, "VISIBLELINES", "5");
  IupSetAttribute(ml, "VISIBLECOLUMNS", "10");
  
  split = IupSplit(bt, ml);
  IupSetAttribute(split, "ORIENTATION", "HORIZONTAL");
  IupSetAttribute(split, "COLOR", "127 127 255");

  vbox = IupVbox(split, NULL);
  IupSetAttribute(vbox, "MARGIN", "10x10");
  IupSetAttribute(vbox, "GAP", "10");

  dlg = IupDialog(vbox);
  IupSetAttribute(dlg, "TITLE", "IupSplit Example");
  //IupSetAttribute(dlg, "RASTERSIZE", "800");
  IupShow(dlg);
}


#ifndef BIG_TEST
int main(int argc, char* argv[])
{
  IupOpen(&argc, &argv);

  SplitTest();

  IupMainLoop();

  IupClose();

  return 0;
}
#endif
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to