Re: XForms: problem with fl_show_form

Giovanni Dodero (dodero@dipfis.ge.infn.it)
Tue, 12 Aug 1997 09:41:55 +0200 (MET DST)

To subscribers of the xforms list from Giovanni Dodero <dodero@dipfis.ge.infn.it> :

I think you forgot to declare extern your fd_PrintForm pointer variable,
try to put it outside the main... ( as I do for you in the following..)

Ciao
Gio ;-)

On Tue, 12 Aug 1997, Raoul Beauduin wrote:

> To subscribers of the xforms list from Raoul Beauduin <beauduin@ori.u-tokyo.ac.jp> :
>
> Here is a very simple program.
> When I run it and click on the button "print", no window pops up.
> I am missing something but I don't know what.
> Thank you for any help.
>
> RB
>
> /*
> To compile:
> gcc -I/usr/X11R6/include -O -o test2 test2.c -lforms -lX11 -lm
> -lsocket -lnsl
> */
> #include "forms.h"
> #include <stdlib.h>
> #include "test.h"
>
> FD_ButtonPrint *create_form_ButtonPrint(void)
> {
> FL_OBJECT *obj;
> FD_ButtonPrint *fdui = (FD_ButtonPrint *) fl_calloc(1, sizeof(*fdui));
>
> fdui->ButtonPrint = fl_bgn_form(FL_NO_BOX, 320, 250);
> obj = fl_add_box(FL_UP_BOX,0,0,320,250,"");
> obj = fl_add_button(FL_NORMAL_BUTTON,110,50,110,40,"Print");
> fl_set_button_shortcut(obj,"Pp",1);
> fl_set_object_callback(obj,PrintCB,0);
> fl_end_form();
>
> fdui->ButtonPrint->fdui = fdui;
>
> return fdui;
> }
> /*---------------------------------------*/
>
> FD_PrintForm *create_form_PrintForm(void)
> {
> FL_OBJECT *obj;
> FD_PrintForm *fdui = (FD_PrintForm *) fl_calloc(1, sizeof(*fdui));
>
> fdui->PrintForm = fl_bgn_form(FL_NO_BOX, 320, 250);
> obj = fl_add_box(FL_UP_BOX,0,0,320,250,"");
> obj = fl_add_checkbutton(FL_PUSH_BUTTON,30,50,80,30,"Printter");
> fl_set_button_shortcut(obj,"#P#p",1);
> obj = fl_add_checkbutton(FL_PUSH_BUTTON,30,110,80,30,"Filename");
> fl_set_button_shortcut(obj,"#F#f",1);
> obj = fl_add_input(FL_NORMAL_INPUT,180,50,120,30,"Printer:");
> obj = fl_add_input(FL_NORMAL_INPUT,180,110,120,30,"Filename:");
> obj = fl_add_button(FL_NORMAL_BUTTON,30,180,120,30,"OK");
> fl_set_button_shortcut(obj,"Oo",1);
> obj = fl_add_button(FL_NORMAL_BUTTON,180,180,120,30,"Cancel");
> fl_set_button_shortcut(obj,"Cc",1);
> fl_end_form();
>
> fdui->PrintForm->fdui = fdui;
>
> return fdui;
> }
> /*---------------------------------------*/
>
> void PrintCB(FL_OBJECT *ob, long data)
> {
> FD_PrintForm *fd_PrintForm;
> fl_show_form(fd_PrintForm->PrintForm, FL_PLACE_MOUSE | FL_FREE_SIZE,
> FL_FULLBORDER, "Print");
> }
>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!LOOK HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FD_PrintForm *fd_PrintForm;
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> int main(int argc, char *argv[])
> {
> FD_ButtonPrint *fd_ButtonPrint;
>
> fl_initialize(&argc, argv, 0, 0, 0);
> fd_ButtonPrint = create_form_ButtonPrint();
> fd_PrintForm = create_form_PrintForm();
>
> /* fill-in form initialization code */
>
> /* show the first form */
>
> fl_show_form(fd_ButtonPrint->ButtonPrint,FL_PLACE_CENTER,FL_FULLBORDER,"ButtonPrint");
> fl_do_forms();
> return 0;
> }
> _________________________________________________
> To unsubscribe, send the message "unsubscribe" to
> xforms-request@bob.usuf2.usuhs.mil or see
> http://bob.usuf2.usuhs.mil/mailserv/xforms.html
> Xforms Home Page: http://bragg.phys.uwm.edu/xforms
> List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/
>

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/