1. EuGTK - fonts
- Posted by Jerry_Story Sep 29, 2010
- 1362 views
set(txtFilter1,"font",fonts[TEXT]) -- no property named 'font' set(txtFilter1,"font_name",fonts[TEXT]) -- no property named 'font_name' set(txtFilter1,"font name",fonts[TEXT]) -- no property named 'font name'
How do you do it?
2. Re: EuGTK - fonts
- Posted by irv Sep 29, 2010
- 1408 views
set(txtFilter1,"font",fonts[TEXT]) -- no property named 'font' set(txtFilter1,"font_name",fonts[TEXT]) -- no property named 'font_name' set(txtFilter1,"font name",fonts[TEXT]) -- no property named 'font name'
How do you do it?
Depends - what is txtFilter1? If it is indeed some kind of filter, i.e. GtkTreeModelFilter ,GtkRecentFilter, or GtkFileFilter - it doesn't have a font, and in fact, isn't ever visible. It just selects items to be displayed, e.g. all *.jpg files in "recent files", or all text files, etc.
3. Re: EuGTK - fonts
- Posted by Jerry_Story Sep 29, 2010
- 1375 views
set(txtFilter1,"font",fonts[TEXT]) -- no property named 'font' set(txtFilter1,"font_name",fonts[TEXT]) -- no property named 'font_name' set(txtFilter1,"font name",fonts[TEXT]) -- no property named 'font name'
How do you do it?
Depends - what is txtFilter1? If it is indeed some kind of filter, i.e. GtkTreeModelFilter ,GtkRecentFilter, or GtkFileFilter - it doesn't have a font, and in fact, isn't ever visible. It just selects items to be displayed, e.g. all *.jpg files in "recent files", or all text files, etc.
txtFilter1 = create(GtkLabel)
The reason why it's called a filter is the user types something in it and the list of foods is filtered by it. For example the user types "al" and all the food names must start with "al".
ALMONDS,DRY RSTD,W/SALT
ALMONDS,DRY RSTD,WO/SALT
ALMONDS,BLANCHED
ALMONDS,OIL RSTD,W/SALT
ALMONDS,OIL RSTD,WO/SALT
ALMONDS
ALMONDS,HONEY RSTD,UNBLANCHED
ALMOND BUTTER,PLN,WO/SALT
ALMOND BUTTER,PLN,W/SALT
ALMOND PASTE
ALFALFA SEEDS,SPROUTED,RAW
4. Re: EuGTK - fonts
- Posted by Jerry_Story Sep 29, 2010
- 1316 views
txtFilter1 = create(GtkLabel)
Actually GtkLabel is not what I want. It doesn't allow typing.
Perhaps
txtFilter1 = create(GtkEntry)
But I'm not sure that's correct. In the wxEuphoria program typing something triggers an event and the list is updated as you type.
5. Re: EuGTK - fonts
- Posted by irv Sep 29, 2010
- 1315 views
set(mylabel,"modify font","Courier 12")
I can't remember all these things either, but try changing to the directory with the EuGTK demos, and typing grep font * In most cases, something like that will pull up several instances to look at.
BTW, I am not at all sure a label is the correct thing to use display a lot of items. Suppose the user types A - he's going to get a very long list, and labels are for short things. You'll find the label extends off the bottom of the screen, and there's no way to see the bottom part.
6. Re: EuGTK - fonts
- Posted by Jerry_Story Sep 29, 2010
- 1308 views
set(mylabel,"modify font","Courier 12")
I can't remember all these things either, but try changing to the directory with the EuGTK demos, and typing grep font * In most cases, something like that will pull up several instances to look at.
Thanks for the tip. That works very well.
BTW, I am not at all sure a label is the correct thing to use display a lot of items. Suppose the user types A - he's going to get a very long list, and labels are for short things. You'll find the label extends off the bottom of the screen, and there's no way to see the bottom part.
The label (or text or whatever) is used to filter the list. The food names are shown in the ListView. That scrolls.
The foods list has a bunch of filters. Unfiltered, it has 7500+ foods. That's 7.5 thousand foods. To cut down on the number of foods in the list, there are a bunch of what I call 'filters'.
Raw only, checked or unchecked
No salt, checked or unchecked
No dried, checked or unchecked
Favorites only, checked or unchecked - foods marked with '*', saved in favorite_foods.ini
Reject rejected foods, checked or unchecked - foods marked with '#', saved in rejected_foods.ini
Food groups, each checked or unchecked
txtFilter1 - must start with this string
txtFilter2 - must include this string
txtFilter3 - must exclude this string
chkLimit, checked or unchecked - limits the list to 300
7. Re: EuGTK - fonts
- Posted by irv Sep 29, 2010
- 1389 views
Well, of course you can write your own filter routines, but GtkListView and GtkTreeView have those built-in. Euphoria's may actually be faster, we'd have to try both and see. The advantage of the built-in filters is that you can use a single list to display different 'sets' of the data in different views, so when you change an item, it is immediately updated wherever it appears.
Even though it's written for mono, there's a good tutorial about the list & view stuff. You can easily see how to translate it to Euphoria.
Now, for the input to your filter: seems like a GtkEntry would work, if the user needs to type something. When he hits enter, your routine to do the filtering could be called:
include GtkEngine.e function Foo(atom ctl) puts(1,"You pressed enter!") printf(1,"Control text is: %s\n",{get(ctl,"text")}) return 1 end function constant win = create(GtkWindow) connect(win,"destroy",quit) constant input = create(GtkEntry) add(win,input) connect(input,"activate",call_back(routine_id("Foo"))) show_all(win) main()
If you want the filter to update after every character is typed (instead of waiting for the enter key) change the "activate" signal to "changed"