EuGTK: notebook control stuff

new topic     » topic index » view thread      » older message » newer message

Hi all,

I have been playing with Irv Mullin's EuGtk library - great contribution Irv! thanks a lot! - but I have some trouble to get the following code to work the way I want to. I have to say that "I don't get it" when it comes to fix the size or position of controls, I guess its done with the "grid" layout but is there any other easier way to do this?something like set(button, width, 20)?? I' ve been navigating with property browser to check aviable methods, etc but I dont seem to find the solution.

Ok, now the question about the notebook control.

I want to create several tabs within a notebook control, eachone conteining an editable text widget for editing different files. I want to maximize the size of the window and the size of the notebook contianer but I dont succeed to achive this.

thanks & regards, Raul Campos

the code (from test42.ex):

include GtkEngine.e 
 
constant win = create(GtkWindow) 
	connect(win,"destroy","Quit") 
	set(win,"position",GTK_WIN_POS_CENTER) 
	set(win,"border width",10) 
	set(win,"default size",400,300) 
    set(win,"icon from file","~/demos/thumbnails/mongoose.png") 
     
constant panel = create(GtkBox,1) 
	add(win,panel) 
 
constant lbl1 = create(GtkLabel) 
	set(lbl1,"markup","<b><u>GtkNotebook</u></b>") 
	set(lbl1,"override font","8") 
	add(panel,lbl1) 
 
constant sep = create(GtkSeparator) 
	add(panel,sep) 
 
constant notebook = create(GtkNotebook) 
	add(panel,notebook) 
 
constant pg1 = create(GtkBox,1) 
	set(notebook,"append page",pg1) 
	add(pg1,create(GtkImage,"~/demos/images/jeff.jpg")) 
 
constant tab2 = create(GtkLabel) 
	set(tab2,"markup","<i><b>LGPL</b></i>") 
 
constant pg2 = create(GtkBox,1) 
	set(notebook,"append page",pg2,tab2) --(3) 
 
constant lbl2 = create(GtkLabel,wrap(LGPL,60)) 
	set(lbl2,"override font","8") 
	set(lbl2,"margin top",10) 
	add(pg2,lbl2) 
 
constant tabpix = create(GtkImage,"~/demos/thumbnails/bar.gif") 
 
 
--------------------------------------- My stuff -------------------- 
 
constant scroller = create(GtkScrolledWindow) 
 
constant tv = create(GtkTextView) 
	set(tv,"wrap mode",GTK_WRAP_WORD_CHAR)	 
	set(tv,"font","Courier 12") 
	add(scroller, tv) 
 
constant buffer = get(tv,"buffer")  
	set(buffer,"text",LGPL) 
 
 
--- 
--- this code runs but gives the following error message: 
--- (test42.ex:1608): Gtk-WARNING **: Attempting to add a widget with type GtkTextView to a container 
--- of type GtkBox, but the widget is already inside a container of type GtkScrolledWindow, please 
--- use gtk_widget_reparent() 
--- 
--- 
--- Note: this has been actually solved 
--- 
 
------------------------------------------------------------- 
 
 
constant pg3 = create(GtkBox,1) 
	set(notebook,"append page",pg3,tabpix) --(4) 
	pack(pg3,scroller,TRUE,TRUE) 
 
add(pg3,tv) 
 
constant btnbox = create(GtkButtonBox) 
	add(btnbox,create(GtkButton,"gtk-quit","Quit")) 
	add(btnbox,create(GtkButton,"gtk-ok","Foo")) 
	pack(pg3,-btnbox) 
 
show_all(win) 
main() 
 
global function Foo() 
Info(win,"OK","Thanks!") 
return 1 
end function 

[added eucode tags -matt]

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu