1. EuGTK:How To Lookup Stuff

I'm wanting to know how to set the justification of label text. How would I go about figuring that out? EuGTK docs or Gtk docs or both? Can you show me the way?

ADD: Found label justification in test11.ex, so I've got that goin' for me.

new topic     » topic index » view message » categorize

2. Re: EuGTK:How To Lookup Stuff

You can justify multi-line text, but not single lines. Look for halign for that. There are several ways to accomplish this.

new topic     » goto parent     » topic index » view message » categorize

3. Re: EuGTK:How To Lookup Stuff

irv said...

You can justify multi-line text, but not single lines. Look for halign for that. There are several ways to accomplish this.

This is working for me:

set(label_trail,"alignment",0.0) 

Not sure how to do it upon label creation, though:

label_trail = create(GtkLabel,"alignment=0.0") 
new topic     » goto parent     » topic index » view message » categorize

4. Re: EuGTK:How To Lookup Stuff

euphoric said...
irv said...

You can justify multi-line text, but not single lines. Look for halign for that. There are several ways to accomplish this.

This is working for me:

set(label_trail,"alignment",0.0) 

Not sure how to do it upon label creation, though:

label_trail = create(GtkLabel,"alignment=0.0") 

You actually have to set xalign separately from the create() function: Don't know why, maybe it can be fixed.

include GtkEngine.e 
 
constant 
    win = create(GtkWindow,"size=300x300,border=10,$destroy=Quit"), 
    pan = create(GtkBox,"orientation=vertical,spacing=10"), 
    lbl = create(GtkLabel,"text=This is a test"), 
    box = create(GtkButtonBox), 
    btn = create(GtkButton,"gtk-quit","Quit") 
    set(lbl,"xalign",0) --* range is 0...1  
     
    add(win,pan) 
    add(pan,lbl) 
    add(box,btn) 
    pack(pan,-box) 
     
show_all(win) 
main() 

EDIT:GtkAlignment is not an {x,y} value, it is a container which can control the layout of whatever is put inside. You probably don't need that, and it is deprecated anyway.

Note that xalign and yalign, if not set, are by default 0.5 and 0.5 (centered) for labels (and most everything else).

Most of this info is in the GTK3 docs. Don't forget that if you look up GtkLabel, and don't see what you are looking for there, follow the Object Hierarchy upward until you find what you need. IOW, label x and y align are provided by the ancestor GtkWidget.

new topic     » goto parent     » topic index » view message » categorize

5. Re: EuGTK:How To Lookup Stuff (General Hint)

Here's something that might help, don't know if it works on Windows, but it won't take but a moment to try:

 
show_all(win) 
set(win,"interactive debugging",1) -- add this line here in your program; 
main() 
 

This (at least on Linux) opens a window showing the complete program hierarchy, click on a widget, and you can see and change all sorts of properties, try different themes, type in css code to change the appearance, etc. etc. etc...

new topic     » goto parent     » topic index » view message » categorize

6. Re: EuGTK:How To Lookup Stuff (General Hint)

irv said...
set(win,"interactive debugging",1) -- add this line here in your program; 

This (at least on Linux) opens a window showing the complete program hierarchy, click on a widget, and you can see and change all sorts of properties, try different themes, type in css code to change the appearance, etc. etc. etc...

Whoa! That's pretty cool!

new topic     » goto parent     » topic index » view message » categorize

7. Re: EuGTK:How To Lookup Stuff (General Hint)

euphoric said...
irv said...
set(win,"interactive debugging",1) -- add this line here in your program; 

This opens a window showing the complete program hierarchy, click on a widget, and you can see and change all sorts of properties, try different themes, type in css code to change the appearance, etc. etc. etc...

Whoa! That's pretty cool!

Don't forget to look at the signals for the various widgets in your program. For the TreeView, as an example, there are more than 50 different "events" that can happen (and which you can catch and respond to if your program requires).

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu