[gnome-love] resizing a text_entry_box with gtk+
- From: Maya <escalante canada com>
- To: gnome-love gnome org
- Subject: [gnome-love] resizing a text_entry_box with gtk+
- Date: Wed, 10 Jul 2002 18:12:44 -0500
I am in the process of porting an application from Qt to Gtk/GNOME tha
uses a large number of gtk_entry_new_with_max_length(??);
but the size of the box inside the table is toooooo large, can anyone
help?
--
The difference between a GRINGO and an AMERICAN is that the
AMERICAN believes that the name of his country is the name
of the continent his country is in, and the GRINGO... well
he is a US citizen who's stupid enough to believe it.
# Gtk Make file
# Compiler name
CC=gcc
# Libraries to be included
LDLIBS=`gnome-config --libs gnomeui`
# Flagas
CFLAGS=-Wall -g `gnome-config --cflags gnomeui`
# Variables
OBJS=main.o createWindow.o
main: $(OBJS)
$(CC) $(LDLIBS) $(OBJS) -o myGNOME
main.o: main.c createWindow.h
$(CC) $(CFLAGS) -c main.c
main_window.o: createWindow.h
$(CC) $(CFLAGS) -c main_window.c
# Remove the following files
PHONY: clean
clean:
clear
rm -f *.o
rm -f myGNOME
#include <gnome.h>
#include "createWindow.h"
int createWindow(int argc, char *argv[])
{
/*main window widget*/
GtkWidget *appWindow;
/*this box contains the other widget buttons*/
GtkWidget *table;
/*internal name*/
gnome_init("gnome_app","VERSION_1", argc, argv);
/*create the main window widget as the top window*/
appWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width(GTK_CONTAINER(appWindow),2);
gtk_signal_connect(GTK_OBJECT(appWindow), "delete_event",
GTK_SIGNAL_FUNC(eventDelete), NULL);
gtk_signal_connect(GTK_OBJECT(appWindow), "destroy",
GTK_SIGNAL_FUNC(eventDestroy), NULL);
table = makeTable();
gtk_container_add(GTK_CONTAINER(appWindow), table);
gtk_widget_show_all(appWindow);
gtk_main();
exit(0);
}
GtkWidget *makeTable()
{
GtkWidget *table;
GtkWidget *textEntry;
table = gtk_table_new(2,2,HOMOGENEOUS);
gtk_widget_show(table);
textEntry = makeTextEntry();
gtk_table_attach(GTK_TABLE(table), /*which table*/
textEntry, /*what widget*/
0, /*left attach*/
1, /*right attach*/
0, /*top attach*/
1, /*bottom attach*/
0, /*xoptions*/
0, /*yoptions*/
0, /*xpading*/
0); /*ypading*/
return(table);
}
GtkWidget *makeTextEntry()
{
GtkWidget *hbox;
GtkWidget *lblDate;
GtkWidget *editBoxMonth;
GtkWidget *editBoxDay;
GtkWidget *editBoxYear;
hbox = gtk_hbox_new(TRUE,0);
lblDate = gtk_label_new("Date \"mm\\dd\\yyyy\"");
gtk_box_pack_start(GTK_BOX(hbox), lblDate, FALSE, FALSE, 0);
gtk_widget_show(lblDate);
editBoxMonth = gtk_entry_new_with_max_length(2);
gtk_box_pack_start(GTK_BOX(hbox), editBoxMonth, FALSE, FALSE, 0);
gtk_widget_show(editBoxMonth);
editBoxDay = gtk_entry_new_with_max_length(2);
gtk_box_pack_start(GTK_BOX(hbox), editBoxDay, FALSE, FALSE, 0);
gtk_widget_show(editBoxDay);
editBoxYear = gtk_entry_new_with_max_length(4);
gtk_box_pack_start(GTK_BOX(hbox), editBoxYear, FALSE, FALSE, 0);
gtk_widget_show(editBoxYear);
return(hbox);
}
gint eventDelete( GtkWidget *widget, GdkEvent *event, gpointer data )
{
return(FALSE);
}
gint eventDestroy(GtkWidget *widget, GdkEvent *event, gpointer data )
{
shutdown();
return 0;
}
void shutdown(){gtk_main_quit();}
void showhelp(){g_print("Show the help window\n");}
void wip()
{
gchar msg[] = "Under construction...";
gnome_ok_dialog(msg);
}
#ifndef CREATE_WINDOW_H
#define CREATE_WINDOW_H 1
#include<gnome.h>
#define HOMOGENEOUS FALSE
int createWindow(int argc, char *argv[]);
GtkWidget *makeTable();
GtkWidget *makeTextEntry();
gint eventDelete( GtkWidget *widget, GdkEvent *event, gpointer data );
gint eventDestroy(GtkWidget *widget, GdkEvent *event, gpointer data );
void shutdown();
void showhelp();
void wip();
#endif
#include <gnome.h>
#include "createWindow.h"
int main(int argc, char *argv[]) { return createWindow(argc, argv);}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]