Re: XForms: Detaching a form from a tabfolder

j.w.c.a. lokin (lokin@signaal.nl)
Wed, 13 Oct 1999 09:17:13 +0200

# To subscribers of the xforms list from "j.w.c.a. lokin" <lokin@signaal.nl> :

This is a multi-part message in MIME format.
--------------F3A9761DE6725CD620C0A1F0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

T.C. Zhao wrote:
>
> Hi,
> I fixed the deletion/detach problem over the weekend.
> V0.89 for Solaris is updated. Please let me know how
> it goes.
> -TC

Thanks for the effort. There seems to be some improvement, but the attached
program still behaves strangely. Detaching a form works, but strange frames
sometimes appear in the other forms. Returning the form seems to mix things up
some more. I still haven't managed to display a detached form in a window of
it's own.

-- 
-+- Jan Willem Lokin -+-
--------------F3A9761DE6725CD620C0A1F0
Content-Type: text/plain; charset=us-ascii; name="tabf.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="tabf.c"

#include "forms.h"

#define butnH 18 #define pageH (12 * butnH) #define butnW (4 * butnH) #define pageW (5 * butnW)

#define NTABS 12

#define POP 1 /* pop a form into its own window (won't work yet!) */

#if POP static FL_FORM *fs[NTABS]; static int fsp;

static void pop_func (FL_OBJECT *obj, long n) { FL_OBJECT *tabfolder = (FL_OBJECT *) n; FL_FORM *form = fl_get_active_folder (tabfolder); fs[fsp++] = form; fl_delete_folder (tabfolder, form); //fl_show_form (form, FL_PLACE_FREE, FL_TRANSIENT, "XXX"); } static void push_func (FL_OBJECT *obj, long n) { FL_OBJECT *tabfolder = (FL_OBJECT *) n; if (fsp > 0) fl_addto_tabfolder (tabfolder, "?", fs[--fsp]); } #endif

static void create_tab (FL_OBJECT *folder, char *title) { FL_FORM *form = fl_bgn_form (FL_FLAT_BOX, pageW + 6, pageH + 6); fl_add_text (FL_NORMAL_TEXT, 0, 0, butnW, butnH, title); fl_end_form (); fl_addto_tabfolder (folder, title, form); }

static FL_OBJECT *create_and (void) { const int andW = pageW + 10, andH = pageH + 31; FL_FORM *form; FL_OBJECT *obj, *tabfolder; int i;

form = fl_bgn_form (FL_FLAT_BOX, andW, andH); fl_set_form_minsize (form, andW, andH); fl_set_form_maxsize (form, andW, DisplayHeight (fl_display, fl_screen) - 25 - 5);

tabfolder = fl_add_tabfolder (FL_TOP_TABFOLDER, 0, 0, andW, andH, 0); // fl_set_object_prehandler (tabfolder, tabfolder_resize_func); // fl_set_object_callback (tabfolder, tabfolder_func, 0);

#if POP obj = fl_add_button (FL_NORMAL_BUTTON, andW - 2 *butnH, 0, butnH, butnH, "-"); fl_set_object_callback (obj, pop_func, (long) tabfolder); obj = fl_add_button (FL_NORMAL_BUTTON, andW - butnH, 0, butnH, butnH, "+"); fl_set_object_callback (obj, push_func, (long) tabfolder); #endif

fl_end_form ();

for (i = 0; i < NTABS; i++) { char tab[8];

sprintf (tab, "%d", i); create_tab (tabfolder, tab); } fl_show_form (form, FL_PLACE_FREE, FL_FULLBORDER, "tabf");

return tabfolder; }

int main (int argc, char *argv[]) { FL_OBJECT *tabfolder;

fl_initialize (&argc, argv, 0, 0, 0);

tabfolder = create_and ();

/* State initialization */

fl_set_folder_byname (tabfolder, "3");

fl_do_forms ();

fprintf (stderr, " *** Unexpected fallthru ***\n"); return 0; }

--------------F3A9761DE6725CD620C0A1F0--

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