obgtk and window events
- From: fractture <fract sprintmail com>
- To: "gtk-list redhat com" <gtk-list redhat com>
- Subject: obgtk and window events
- Date: Fri, 24 Apr 1998 15:44:07 -0700
Still wondering about my question about the delete_event and destroy.
I will put my code here with comments about various things...
I just want to know, if there is a reason it was designed this
way....why...and if it is a bug,...I would like to know so I don't beat
my head on the wall trying to figure out the correct way.
In hello_world.c in the tutorial, it is described what delete does and
why it is different from destroy, and how not to close the window. I
want to recreate that in this program..
interface has Gtk_Window *window; Gtk_Button *Button;
@implementation HelloWorld
- clicked:(id)anObj
{
g_print("Hello World!!\n");
return self;
}
-(gint)delete:(id)anObj
/* if this method is removed and the window is connected in any way
to "delete"
this class will not compile... */
{
g_print("A delete event was recieved.");
return TRUE;
}
-destroy:(id)anObj
{
[window free];
[self free];
return self;
}
- initApp:(int *)argcp
:(char ***)argvp
{
[super initApp:argcp :argvp];
window = [[Gtk_Window alloc]
initWithWindowType:GTK_WINDOW_TOPLEVEL];
/* this will compile without errors, but if a "delete_event" or "destoy"
is sent
program complains and freaks. Lot of wierd non chars. */
[window connectObj:"delete_event" :self];
[window connectObj:"destroy" :self];
button = [[Gtk_Button alloc] initWithLabel:"Hello"];
[[button connectObj:"clicked" :self] show];
[[window add:button] show];
return self;
}
@end
int main(int argc, char *argv[]) {
[[[HelloWorld alloc]initApp:&argc :&argv] run];
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]