|
Pages: [1]
|
 |
|
Author
|
Topic: How to start application focused on area for text input (Read 667 times)
|
|
Reboludo
|
Dear friends, I am new to REBOL and have very happily completed my first very useful productivity tool. I'm in Ubuntu LINUX and already have it where I just click an icon and it starts and works great. 1. However, after I click on its icon, I still have to click on the area that is for text input. I would like this application to start with the area for text input already focused, so once I click the starting icon, I can start typing, without having to gain focus by having to click on that text-input area. The application is quite simple. It only has that one text area and a button to do its job and quit. 2. The other thing is I would like to see if the text that I am typing can use an improved font. I've tried all aproaches I found on the tutorials and elsewhere, but can only increase the size, and use one of 3 styles. That's important for readability. I don't need a fancy font. The font I have setup for my terminal would be fine. (Can use System's fonts?) However, even if these two aspects are not readily achievable, this little utility is worth the time I spent learning to make it, and finding out so many beautiful things on this REBOL system. I've been looking for this type of system for years, and I'm not a kid. I have plans and setups now to go further on learning/using REBOL. Thanks to everyone involved in its use and support, and specially to the developer, and teams of helpers of all times. 
|
|
|
|
|
Logged
|
|
|
|
|
Sunanda
|
If you use the focus word, it sets the focus to a named field, eg: view/new layout [ h2 "Focus demo" f1: field "field 1" f2: field "field 2" ]
focus f2 do-events
The focus is on field2 when the window appears. Apologies if this does not fix a specific problem with Ubuntu -- I do not have that to test with. Sunanda
|
|
|
|
|
Logged
|
|
|
|
|
Reboludo
|
Hi there, Sunand. I have now solved my question on an area being focused at start up, so I can immediately key-in text, just as wanted. This is the solution: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MyView: layout [ MyArea: area button "Quit" [quit] ] focus MyArea view MyView ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In the [Quit] block, before the word quit, I put all the actions I want to do with the text entered. As to your suggestion, first of all I don't have 'fields', but 'area', because i need to put lines of text into it. Second, your code, as provided, did not work. It freezes, and I don't believe it has to do with Ubuntu LINUX. I do thank you for what you posted, though, since researching it lead me to figure out the way. I still would like to hear on my above question concerning fonts management in the 'area'. 
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
Examples of font settings in VID: view layout [text font-name "Verdana" font-size 16 bold "This is a test"]
view layout [text font [name: "Verdana" size: 16 style: 'bold] "This is a test"]
HTH. (Some versions of View have problems with fonts on recent Linux distros. I tested the above on Kubuntu 8.04 with REBOL 2.7.6.)
|
|
|
|
|
Logged
|
|
|
|
|
Sunanda
|
Glad to hear my code pointed you in the right direction. Though sorry to hear it did not work under Ubuntu. I did test it! Though on another platform  Perhaps the problem lies in the interaction between your modifications, and my use the the view /new refinement and the do-events way of starting a VID session.
|
|
|
|
|
Logged
|
|
|
|
|
Reboludo
|
Glad to hear my code pointed you in the right direction. Though sorry to hear it did not work under Ubuntu. I did test it! Though on another platform  Perhaps the problem lies in the interaction between your modifications, and my use the the view /new refinement and the do-events way of starting a VID session. Hi again dear Sundanda, I haven't gotten to the refinements you mention yet (been on REBOL only two days so far), but I do get your code to work as follows: MyView: view [ layout h2 "Focus demo" f1: field "field 1" f2: field "field 2" ]
focus f2 view MyView Thanks again for your good interest and help. 
|
|
|
|
|
Logged
|
|
|
|
|
Reboludo
|
Hi again Sundanda,
In checking the function do-events, the following is foud: ------------------------------------------------------- Do-events - Function Summary Summary:
Process all View events. Usage:
do-events Description:
Process user events. When this function is called the program becomes event driven. This function does not return until all windows have been closed. ---------------------------
When I pasted your exact code on my REBOL console, the field F2 is indeed focused, but the cursor can not enter ANY of the two fields, nor the button, furthermore, the view CAN NOT be closed even by its [X] click-to close window-frame button. Nothing can be clicked. I can only close it by closing the REBOL console.
It seems that "the function does not return untill all windows have been closed" has something to do. Perhaps in another platform events are handled different than in Ubuntu Linux,
But all REBOL works OK in Ubunto when I do things right.
Not all I wish will be there, of course. But even my fonts question on this same thread I have resolved within practicality, for there seem to be some things that are not implemented here, having to do with the quality of the text and some attributes, particularly when text is input in an AREA 's region.
I will shortly post in this same thread how simply I did get acceptable text readability on my little but useful utility.
If I find the problem here with the do-events, will report back to you.
Thanks again.
|
|
|
|
|
Logged
|
|
|
|
|
Reboludo
|
Examples of font settings in VID: view layout [text font-name "Verdana" font-size 16 bold "This is a test"]
view layout [text font [name: "Verdana" size: 16 style: 'bold] "This is a test"]
HTH. (Some versions of View have problems with fonts on recent Linux distros. I tested the above on Kubuntu 8.04 with REBOL 2.7.6.) Hi Gabriele, and thanks for your assistance. I did go over what you suggest and found that Ubuntu does do the font changes but not in full response (till I learn some more, hopefully). It seems like the resolution render by REBOL is lower, or something like that, and font-size in some faces seems to have no effect. But I did get my need resolved to improve readability of what I type into the "area" space, quite simply, as follows: MyView: layout [ MyArea: area bold font-size 14 ;;;;;;;;;;; <======== ;;;;;;;;; button "Quit" [quit] ] focus MyArea view MyView ALSO, I did try the FATEST looking fonts, including combinations of bold and size without significant improvement, so what was done is just use 'bold' and font-size 14 as shown where the arrow is on the code. With fancy fonts like hand-script or comic, the lower resolution rendered is much more notorious. That's why default font, bold, and a little size increase seemed overal best for the need here. I am grateful and happy to relate to you all in this common interest.
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
Which version of REBOL are you using? The problems you describe match the ones known in older versions with recent distributions.
About do-events, the problem you see is caused by the fact that you did the view/new WITHOUT doing do-events afterwards. If events are not being processed, you can't do anything on the window (not even close it). Try that code on a script (instead of the console), or, at the console, make sure you click back on the console window after the view/new and execute the do-events.
|
|
|
|
|
Logged
|
|
|
|
|
Reboludo
|
Hi Gabriele, Thank you for enlightening me on the do-events. I did go over and pasted the code Sunanda gave us and indeed, one has to do click on the console one more [Enter] so that the 'do-events' line gets executed, and THEN, indeed, the fields are accessible, and the window can be closed. I trust that if it's run via a script, with no console, all will be OK. I do very much appreciate your lifting me out of that very important fundamental, for the principle surely applies to others situations. As to versions, it's REBOL 2.76 (I believe this is the latest, not the new 3-beta). As to Ubntu it's Ubunto 7.10 Gutsy Gibon, up-to-date on updates. Could you take my simple code, and without using 'bold', make it work by font-name (any font), and font-size of, say 16, and if it works on your system (which is it?), please post it so I can try it exactly as you do it, to see if it works on mine too? Of course I will use a font that I verify is on my system. I'd just need to see where and how you put the font-size and the font-name to make it work. Maybe I am missing something. The code would be: ------------------------------ MyView: layout [ MyArea: area bold font-size 14 ;;;;;;;;;;; <== HERE, don't use BOLD====== ;;;;;;;;; button "Quit" [quit] ] focus MyArea view MyView --------------------------------- Secondly, if it works with font-name and font-size, can one still add 'bold' to make it fatter and even more readable? If so, put that second code also? Thanks a lot, and I hope this is not too much asking. 
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
As to versions, it's REBOL 2.76 (I believe this is the latest, not the new 3-beta).
Yep, that's the latest and the one I'm using too. As to Ubntu it's Ubunto 7.10 Gutsy Gibon, up-to-date on updates.
I was on that version until a month ago or so. Could you take my simple code, and without using 'bold', make it work by font-name (any font), and font-size of, say 16, and if it works on your system (which is it?), please post it so I can try it exactly as you do it, to see if it works on mine too? Of course I will use a font that I verify is on my system.
What I posted above should work, or for an area: view layout [area font-name "Comic Sans MS" font-size 17]
You can either use the FONT facet and provide a block such as [name: "font name" size: 16 style: 'italic] or use the facets font-name, font-size and bold, italic etc. If this doesn't work for you, then there's some difference between our systems that is the problem. My suspect is that there may be some package you must install to make REBOL happy, but I don't remember installing anything specific. I have the msttcorefonts package installed, but that's mainly to make web sites and wine happier. I also have the bitmap fonts installed, REBOL tends to use them by default, but you should still be able to use the scalable ones if you specify the font name directly like in the above; however it's worth trying installing them if you don't have them installed (but I think Ubuntu installs them by default). I can't think of anything else right now... Maybe since you're on Gnome which uses Pango the "old" X font system is not completely installed while KDE still uses it and installs it? You may try installing something like the old xfontsel tool and see what it depends on...
|
|
|
|
|
Logged
|
|
|
|
|
Reboludo
|
Hi again, Gabriele.
And thanks for your help and clarifications.
When I was typing --------- font-name Purisa ---------
got this error message: ------- ** Script Error: Purisa has no value -------
However, that's because Purisa has to be enclosed by quotation marks.
(I had assumed that since font-name has to be text, it would not need quotation marks unless the name was more than one word).
When enclosing the font-name in quotation marks ("Purisa"), the code works and font-size also works. Purisa, by the way, is a 'comic-style' font in this Ubuntu.
However, the resolution still looks poor, and maybe it's because I need to use a scalable font, as you say.
Also, the word bold makes no difference if I use font-name font-size bold.
However, when I do not specify font-name, the word bold does work and so does font-size, meaning that the font used is the default font of an area, in my case.
I will try with scalable fonts, and will install some other fonts if necessary, and will also check that font quality in another software, same system, when modifying it to make sure it's not the font.
I'm happy and grateful. Thank you very much!
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |
News: 01-09-08 Alpha version of REBOL 3 has been released!
2287 Posts in 593 Topics by 3733 Members
Latest Member: Daeujic
|