This example, ex_PtFlush.g, is included in the gamma_ph_#_examples_1_QNX4.tgz file available on the Cogent Web Site.
#!/usr/cogent/bin/phgamma
/*
This example draws buttons on the screen, using PtExtentWidget() to
resize the window. PtFlush() is used to force the drawing of new
buttons before the window is resized. Commenting out PtFlush() allows
the window to resize as the buttons are created, using flush_events().
*/
require_lisp("PhotonWidgets");
PtInit(nil);
win = new(PtWindow);
win.resize_flags = Pt_RESIZE_X_ALWAYS | Pt_RESIZE_Y_ALWAYS;
PtRealizeWidget(win);
but_array = make_array(0);
for(i=0;i<10;i++)
{
but_array[i] = new(PtButton);
but_array[i].text_string = "Button";
but_array[i].SetPos((i * 20), (i * 15));
PtRealizeWidget(but_array[i]);
PtFlush();
nanosleep(0,500000000);
PtExtentWidget(win);
flush_events();
nanosleep(0,500000000);
}
PtMainLoop();