Notice that "IupSetAttribute*s"* actually returns the same Ihandle* that
receives. It is different from "IupSetAttribute". So you can get control if
needed.

  I changed the gridbox.c sample to include your code. It is attached.

  This is the resul:

[image: Inline image 1]

Best,
Scuri


On Fri, Dec 23, 2016 at 7:00 PM, Andrew Robinson <arobinso...@cox.net>
wrote:

> Thanks for a very quick response.
>
> I find that I whether I have NULL or not for the second parameter of
> IupLabel, makes no difference to the output. For 64-bit programs passing
> two parameters, all that NULL would do is set RDX to zero, which generally
> has no effect on programs. But is that all you found wrong with my
> "snippet"? I mean when I compile my program, nothing gets drawn on the
> client window -- it is completely blank. I get no errors and nothing
> crashes, yet if I replace "IupGridBox" with IupVbox or IupHbox (and comment
> out the IupSetAttributes), it works as expected. Something has to be
> missing.
>
> I wish I had a working example of a program and its code that uses
> IupGridBox. The example code given in the IUP documentation is a
> little...unorthodox. The example IUP gives uses IupSetAttribute to create
> all the controls, which is cumbersome and doesn't provide much control over
> the manipulation of the controls (such as adding callbacks) since
> IupSetAttribute doesn't return any handles. Do you have anything like that?
>
> Best regards,
>
> On 12/23/2016 at 12:12 PM, Antonio Scuri <antonio.sc...@gmail.com> wrote:
>
>   Hi,
>
>   There is a small error at the label creation:
>
> Ihandle *lbl1 = IupLabel("Label_1", NULL);
> Ihandle *lbl2 = IupLabel("Label_2", NULL);
>
>   Should be:
>
> Ihandle *lbl1 = IupLabel("Label_1");
> Ihandle *lbl2 = IupLabel("Label_2");
>
>   The result is something like:
>
> [image: Inline image 1]
>
>   It needs a little bit more alignment and gap to improve the visual
> result, but it is correct.
>
> Best,
> Scuri
>
>
> On Thu, Dec 22, 2016 at 10:34 PM, Andrew Robinson <arobinso...@cox.net>
> wrote:
>
>> The following code snippet doesn't work:
>>
>> lbl1 = IupLabel("Label_1",NULL);
>> btn1 = IupButton("Btn1",NULL);
>> lbl2 = IupLabel("Label_2",NULL);
>> btn2 = IupButton("Btn2",NULL);
>> gbox = IupGridBox(lbl1,btn1,lbl2,btn2,NULL);
>> IupSetAttribute(gbox,"ORIENTATION","HORIZONTAL");
>> IupSetAttribute(gbox,"NUMDIV","2");
>>
>> If I use IupGridBox with IupVbox or IupHbox, everything works as
>> expected. What is missing from the instructions that I am not doing with
>> IupGridBox?
>>
>> I am using Win7 64-bit with 64-bit version of IUP, version 3.20.
>>
>> Thanks,
>>
>> ------------------------------------------------------------
>> ------------------
>> Developer Access Program for Intel Xeon Phi Processors
>> Access to Intel Xeon Phi processor-based developer platforms.
>> With one year of Intel Parallel Studio XE.
>> Training and support from Colfax.
>> Order your platform today.http://sdm.link/intel
>> _______________________________________________
>> Iup-users mailing list
>> Iup-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>
>>
>
>
> ------------------------------------------------------------
> ------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today.http://sdm.link/intel
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
#include <stdlib.h>
#include <stdio.h>
#include <iup.h>

void GridBoxTest(void)
{
  Ihandle *dlg;
  Ihandle *gbox;

  Ihandle* lbl1 = IupSetAttributes(IupLabel("Label_1"), "FONTSTYLE=Bold");
  Ihandle* btn1 = IupButton("Btn1", NULL);
  Ihandle* lbl2 = IupLabel("Label_2");
  Ihandle* btn2 = IupButton("Btn2", NULL);
  gbox = IupGridBox(lbl1, btn1, lbl2, btn2, NULL);
  IupSetAttribute(gbox, "ORIENTATION", "HORIZONTAL");
  IupSetAttribute(gbox, "NUMDIV", "2");

  dlg = IupDialog
  (
    IupHbox
    (
      gbox,
      NULL
    )
  );

  IupSetAttribute(dlg, "TITLE", "IupGridBox Test");
  IupSetAttribute(dlg, "MARGIN", "10x10");
//  IupSetAttribute(gbox, "MARGIN", "0x0");   /* avoid attribute propagation */

  /* Shows dlg in the center of the screen */
  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
}

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

  GridBoxTest();

  IupMainLoop();

  IupClose();

  return EXIT_SUCCESS;
}
#endif
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to