Fwd: Re: window resizing





Paolo,
Thanks for your reply and comments. I have implemented the changes which I have included below, but I still have the same problem. Maybe it is a bug?

GtkWidget* create_Start_up_wnd(void)
{
  GtkWidget* Start_up_wnd;
  char*          Start_up_wnd_text;
  GtkWidget* Start_up_wnd_label;

  Start_up_wnd = gtk_dialog_new_with_buttons("P-Syn",
                                             NULL,
                                             GTK_DIALOG_MODAL,
                                             GTK_STOCK_OK,
                                             GTK_RESPONSE_OK,
                                             NULL);
  gtk_widget_set_size_request(Start_up_wnd,460,220);
  gtk_window_set_resizable(GTK_WINDOW(Start_up_wnd),FALSE);
  gtk_window_set_position(GTK_WINDOW(Start_up_wnd),GTK_WIN_POS_CENTER);

Start_up_wnd_text = g_strdup_printf(" P-Syn Version %s, Copyright (C) 2004 Richard Gipps\n\n P-Syn comes with ABSOLUTELY NO WARRANTY; for details\nselect Help -> Warranty from the P-Syn main menu. This is free\n software, and you are welcome to redistribute it under certain\nconditions; select Help -> Distribution from the P-Syn main menu.",P_SYN_VERSION);
  Start_up_wnd_label = gtk_label_new((gchar*)Start_up_wnd_text);
  gtk_container_add(GTK_CONTAINER(GTK_DIALOG(Start_up_wnd)->vbox),Start_up_wnd_label);


  //Connect signal to the OK button
  g_signal_connect_swapped(Start_up_wnd,
                           "response",
                           G_CALLBACK(gtk_widget_destroy),
                           Start_up_wnd);

  g_free(Start_up_wnd_text);
  return Start_up_wnd;
}

Richard.




Delivered-To: rgipps mx3 netspace net au
Subject: Re: window resizing
From: Paolo Borelli <pborelli katamail com>
To: Richard Gipps <rgipps netspace net au>
Date: Thu, 01 Jul 2004 09:06:12 +0200
X-Mailer: Evolution 1.5.9.1 (1.5.9.1-2)
X-Spam-Status: No, hits=-4.8 tagged_above=-50.0 required=500.0 tests=BAYES_00,
 RCVD_IN_RFCI
X-Spam-Level:

On Wed, 2004-06-30 at 20:50 +0100, Richard Gipps wrote:
> I am developing an application using GTK+ 2.4.1 for windows and I have some
> code to create a dialog box with resizable set to FALSE, yet I can still
> resize the window (in the verticle direction only) by a small amount and I
> can not work out why?  Here is the code:
>

No idea... maybe a problem with using GtkFixed? Note that using GtkFixed
is *heavily* discouraged...

couple of suggestion below (not related to your question)

> GtkWidget* create_Start_up_wnd(void)
> {
>    GtkWidget* Start_up_wnd;
>    char                 Start_up_wnd_text[500] = "/0";

don't use an array on the stack. You are wasting 500 precious bytes on
the stack and you can into problems if your string (for instance in a
translation) overflows 500.

use a string:
char *tmp;
...
tmp = g_strdup_printf("blah blah")
...
g_free(tmp);

>    GtkWidget* Start_up_wnd_label;
>    GtkWidget* Start_up_wnd_fixed;
>
>     Start_up_wnd = gtk_dialog_new_with_buttons("P-Syn",
>                                                NULL,
>                                                GTK_DIALOG_MODAL,
>                                                GTK_STOCK_OK,
>                                                GTK_RESPONSE_OK,
>                                                NULL);
>    gtk_window_set_position(GTK_WINDOW(Start_up_wnd),GTK_WIN_POS_CENTER);
>    gtk_window_set_resizable(GTK_WINDOW(Start_up_wnd),FALSE);
>
>    //Create fixed area
>    Start_up_wnd_fixed = gtk_fixed_new();

as I said above do not use fixed. Just gtk_box_pack_start (or in this
simple case also container_add will do) the label into dialog->vbox. You
can tweak borders and padding for extra control on the look.

>    gtk_widget_set_usize(GTK_WIDGET(Start_up_wnd_fixed),462,195);

this is deprecated, gtk_window_set_default_size on the whole dialog
instead.

> gtk_container_add(GTK_CONTAINER(GTK_DIALOG(Start_up_wnd)->vbox),Start_up_wnd_fixed);
>
>    sprintf(Start_up_wnd_text,"\n      P-Syn Version %s, Copyright (C) 2004
> Richard Gipps\n\n  P-Syn comes with ABSOLUTELY NO WARRANTY; for
> details\nselect Help -> Warranty from the P-Syn main menu. This is free\n
> software, and you are welcome to redistribute it under certain\nconditions;
> select Help -> Distribution from the P-Syn main menu.",P_SYN_VERSION);
>
>    Start_up_wnd_label = gtk_label_new((gchar*)Start_up_wnd_text);
>    gtk_fixed_put(GTK_FIXED(Start_up_wnd_fixed),Start_up_wnd_label,28,28);
>
>    //Connect signal to the OK button
>    g_signal_connect(GTK_OBJECT(Start_up_wnd),

nitpick: GTK_OBJECT -> G_OBJECT

>                     "response",
>                     G_CALLBACK(On_Start_up_wnd_OK_button_clicked),
>                     NULL);
>
>    return Start_up_wnd;
> }
>
> Richard.

ciao
        paolo




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]