World: r3wp
[View] discuss view related issues
older newer | first last |
Anton 6-Oct-2006 [5748] | All words remember their values, unless you rebind the words to a different context. Whether a word is in a function body block or not doesn't matter. |
Ladislav 6-Oct-2006 [5749] | warning! according to the documentation it is possible that in the future REBOL function words will be set to #[none!] or something else when the function returns |
Henrik 8-Oct-2006 [5750x2] | Anyone have an idea on how INFORM stops the event system and returns to the console after pressing a button, allowing it to return a value? I've been studying the source of SHOW-POPUP, HIDE-POPUP, INFORM and the various POPFACE-FEEL objects, but I can't figure out how it's done. |
pressing a button = pressing a button in an INFORM | |
Gabriele 9-Oct-2006 [5752x2] | check the wake-event function |
basically, inform does a new wait [] | |
Anton 9-Oct-2006 [5754] | Starting at the top: system/view/event-port/awake ---> system/view/wake-event |
Gabriele 9-Oct-2006 [5755x2] | wake-event behaves differently when there is a popup open |
it returns true (which makes wait [] return) when hide-popup has been called | |
Anton 9-Oct-2006 [5757x2] | Yes, wake-event calls system/view/popface/feel |
inform calls show-popup which creates your new pop-face. | |
Rebolek 12-Oct-2006 [5759] | simple and almost useless tool :) do http://bolek.techno.cz/reb/webtext.r |
Anton 12-Oct-2006 [5760] | Hmm not bad. |
Gregg 12-Oct-2006 [5761] | Very cool bolek! With a few more fields for control of color and gradients, and the ability to save as an image, I would suggest it for inclusion as a Desktop entry with things like Font-lab and such. |
Rebolek 12-Oct-2006 [5762] | Good idea, Gregg, I'll look into it! Hm, guess I should finish Texture-lab also... :) |
Gregg 12-Oct-2006 [5763] | Yes! That was a way cool app. |
Rebolek 12-Oct-2006 [5764] | Updated version of TextureLab - do http://bolek.techno.cz/reb/texture-lab.r |
Louis 14-Oct-2006 [5765x6] | What could be causing this error. I get it whither I encap or not. ** Script Error: trans-date has no value ** Where: switch ** Near: forall args [ val: first args switch/default type?/word val [ pair! [append pairs val] integer... So far as I know I haven't touched this part of the script this is found in. |
Is there anything wrong with this: style dater txt bold right [trans-date/text: copy (to-string now/date)] 48x24 | |
or this: dater "T-Date:" trans-date: field 80x24 (to-string now/date) feel [ engage: func [face action event][ if action = 'up [ lv-dat: request-date/date/offset (now/date) 315x30 if lv-dat <> none [ trans-date/text: copy to string! lv-dat show trans-date ] ] ] ;trans-date/text: copy (to-string now/date) show trans-date ] | |
I really have trouble debugging view scripts, especially long complicated ones. Usually, I make only one of two changes, then run the script. That way I know what part of the code is actually causing the error. This time, however, after making some changes I had to take care of an unrelated problem before I had opportunity to test the script. Now several months later, I finally have time to test, but ... I can't remember what the last changes were. | |
Has anyone written a "How to debug REBOL/View" doc? | |
Are there any debug tools? | |
Graham 14-Oct-2006 [5771x3] | Your error says 'trans-date is not defined. |
trans-date is defined in your layout .. so therefore must be reference before the layout is created if you have that error. | |
without seeing the relevant part it may be that the problem is that your style references a field which has not been defined yet. | |
Louis 14-Oct-2006 [5774x2] | Thank, Graham. I'm looking. |
I was using the wrong version of the SDK. | |
Anton 14-Oct-2006 [5776] | Louis, you're doing something strange there with the SHOW in the feel. |
Louis 14-Oct-2006 [5777x2] | I couldn't find the error because it didn't exist in the code. :>) |
Anton, you mean because there are two shows? | |
Anton 14-Oct-2006 [5779x2] | No, when you specify a feel spec block, you're actually doing something like this: feel: make feel [ 1) engage: func ... 2) show trans-date ] |
You are making an object. On line 1) you are replacing the value of the 'engage word with a new function value of your own. On line 2) you are simply doing some code. So this code executes at the time of the object creation. | |
Louis 14-Oct-2006 [5781] | OK, how do I do it right? |
Anton 14-Oct-2006 [5782x5] | Looking at the code I assume what you want to do is initialise the text facet and make sure it's shown the first time the display is shown. |
Well, you shouldn't have to SHOW the first time - that should be taken care of by VIEW or the SHOW that shows your whole layouted face in which you have your dater and trans-date field. | |
So that just leaves setting the text correctly the first time. And you are already doing that. | |
So just remove those two final lines from the feel spec. | |
By the way, to-string already makes a copy. >> same? (to string! str: "example") str == false | |
Louis 14-Oct-2006 [5787] | I'm learning a lot tonight. Thanks. |
Anton 14-Oct-2006 [5788] | Welcome. |
Robert 15-Oct-2006 [5789] | I have a question WRT changing the text of a shown label. I use a way where the layout of my GUI is done at startup-time once. Now I need to change the text of some labels at run-time and I don't want to do the following: - name each label that needs to be updated. - write a function that changes the TEXT word and shows the widget I would like to use a word in the initial context that keeps a reference to the text (or function returning the text) which gets reevaluated if a SHOW is used. Do I have to write an own style that supports this or is there a simpler way? |
Henrik 15-Oct-2006 [5790x2] | an easy way is to keep all labels in a panel and then traverse the pane and set the label texts on a label. |
if your panel consists of multiple different types of faces, you can filter on 'style | |
Anton 15-Oct-2006 [5792x4] | How about this: |
data: ["hello" "there" "robert"] spec: copy [] foreach string data [ append spec compose [label 100 (string)] ] view window: layout append spec [ btn "change original strings" [ insert clear data/1 "happy" insert clear data/2 "to be" insert clear data/3 "changed" show window ] ] | |
You have to make sure the initial labels are large enough for your longest strings. Of course we can stylize label so that it resizes automatically, but maybe you don't need that. | |
Henrik's way can be helped using SET-FACE, I think. (I haven't used this feature yet.) Have a look in svv/vid-styles/panel/access 'set-face* | |
Robert 15-Oct-2006 [5796x2] | Anton, ah the insert clear method... I missed this one. I think that's the way to go. I'll check this out. Thanks. |
Hmm... one more. Let's I have: label-text: "The current value is ?" and I know want to change the ? dynamically. After first replacement the ? is gone. So I need some way to keep the source version. Or first insert the source version, than replace and show. | |
older newer | first last |