World: r3wp
[Rebol School] Rebol School
older newer | first last |
Geomol 6-Oct-2011 [3940x2] | In your example, you use the LAYOUT dialect, and you have to follow the rules of that dialect. A dialect is a sequence of datatypes, that hold a certain meaning, because they're used in a certain context. |
But try put the DO [..] block in, as I suggested, and tell us, if it works then. | |
todun 6-Oct-2011 [3942x2] | @Geomol, when I run the script with the DO include, I get the following: |
>> do %circular_series.r ** Script Error: btn has no value ** Where: forever ** Near: show-one: btn "Show answer" [ one-position: ++ current-position line: pick lines one-position result/text:... | |
Geomol 6-Oct-2011 [3944] | Eh, did you put the new DO block around all the content inside your LAYOUT block? I just suggested, you should put it around the first 3 lines. |
todun 6-Oct-2011 [3945] | @Geomol, that dialect description is helpful. What context can I use a dialect, the VID in this case, and how do I know what data-types to use and what external things to the dialect to use(or not to use)? |
Geomol 6-Oct-2011 [3946] | To know, how to use the LAYOUT dialect, read the doc: http://www.rebol.com/docs/view-guide.html That's what we do. |
todun 6-Oct-2011 [3947x2] | @Geomol, oh ok. let me change that now. |
@Geomol, I've looked at that doc. It doesn't specifically tell you anywhere what to do with the dialect when you want to introduce foriegn coding to the dialect. | |
Geomol 6-Oct-2011 [3949] | Yes, it does. At: http://www.rebol.com/docs/view-guide.html#section-44 |
todun 6-Oct-2011 [3950x5] | I stand corrected. Maybe that didn't make sense to me at the time, or I skipped that part of the doc. |
@Geomol, so why don't I put the DO[...] around code inside the btn blocks that are not like VID commands? | |
I mean to ask, why does it work? | |
my ultimate goal is to deal with circular lists. Using this doc, I can make one:http://www.rebol.net/cookbook/recipes/0017.html | |
but I want to be able to always go round around the list, go round around the file and also write to file the current location I am at. | |
Geomol 6-Oct-2011 [3955] | Because those blocks are action facets described here: http://www.rebol.com/docs/view-guide.html#section-17 When you interact with a style, in this case a button, those blocks are evaluated as if they were normal REBOL code, so the rules of the layout dialect doesn't rule there. |
todun 6-Oct-2011 [3956x3] | @Geomol, thanks for clearing that up |
Doing a file access and then storing the state of your access, writing that to file, seems quite difficult to formulate in REBOL, for me anyways. | |
What I mean is that, if I read the file and end my read at a particular location before closing the GUI, does REBOL allow you to presist your state across executions of the program? | |
Geomol 6-Oct-2011 [3959] | Things like INDEX? will tell you, where you are in a series. And you can easily save rebol code/values to disc using the SAVE function, and load them again with the LOAD function. |
todun 6-Oct-2011 [3960x2] | @Geomol, INDEX? will tell me its position, but the circular series link I sent you talks about how to always go around and around the series. I want to do the same with the lines of a file, but I'm not sure how to do it without using REPEAT |
I don't want to use REPEAT because I only want to do it while I press the button | |
Geomol 6-Oct-2011 [3962] | Pass! I'm not enough into your problem to point you into a direction. But go on and read some more of the docs, and you should be able to help yourself some more: http://www.rebol.com/docs/core23/rebolcore.html http://www.rebol.com/docs/dictionary.html |
todun 6-Oct-2011 [3963] | @Geomel, thanks. Also, is it allowed for me to use REBOL/Core when doing stuff in REBOL/View? |
Henrik 6-Oct-2011 [3964] | graphics related stuff is not possible in REBOL/Core. |
GrahamC 6-Oct-2011 [3965] | R/View incorportes R/Core |
todun 6-Oct-2011 [3966] | @Henrik, @GrahamC, thanks. |
todun 8-Oct-2011 [3967x2] | Is there anyway to clear an info view after a button is pressed? |
For example, if I press question button(displays the question in an info view), and then I press answer button(which displays the corresponding answer), when next I press question, I want the answer info view to go back to being blank. How can I do this? thanks. | |
Sunanda 8-Oct-2011 [3969x2] | The code in the next post demonstates most of the mechanics of what you are asking for: |
question-database: [ ["Doctor who?" "Oops -- silence has fallen"] ["Is there a doctor in the house?" "Yes -- his name is Gregory"] ] next-question: func [ ;; function to find and display the next question ][ question-database: next question-database if tail? question-database [question-database: head question-database] question-field/text: first first question-database answer-field/text: "" show question-field show answer-field ] ;; code to define and run the panel unview/all view/new layout [ across question-field: field "" answer-field: field "" return answer-button: button "show answer" [ answer-field/text: second first question-database show answer-field ] next-button: button "Next question" [ next-question ] ] ;; open code to start it running next-question do-events | |
todun 8-Oct-2011 [3971] | @Sunanda, thanks. Let me play with it to see where the info view reseting takes place. |
Henrik 8-Oct-2011 [3972x2] | try SET-FACE and CLEAR-FACE instead of setting and clearing face/text directly. |
if you use: source set-face you can see what it does | |
todun 8-Oct-2011 [3974x2] | @Henrik, thanks. will do. |
@Henrik, do you mean 'help set-face' ? | |
Henrik 8-Oct-2011 [3976] | yes, also that. I thought you would be interested in the source as well. |
todun 8-Oct-2011 [3977] | @Henrik, thanks. |
Sunanda 8-Oct-2011 [3978] | the resetting happens at the places where you see ... xxxx/text: "" ;; (changes the value in the field) show xxx ;; (redisplays the field on screen) |
todun 8-Oct-2011 [3979] | @Sunanda, thanks again for pointing that out. |
Singy 23-Nov-2011 [3980x2] | When I run this program via Crimson Editor it works perfectly: |
ip: ["DC1" 10.75.48.14 "DC2" 10.75.48.11 ] foreach [name address] ip [ tmp: copy "" print join "Pinging " name print "***********************************************************" call/output reform ["ping " address " -n 2"] tmp print [head clear find/last tmp "Ping"] ] When I run it via a shortcut (on Windows 7) it prints this: Pinging DC1 ***************************************** and then it just hangs until I force it close. Any ideas why running it via a shortcut would do this when running it via Crimson it works fine??? | |
Pekr 23-Nov-2011 [3982] | What's your shortcut command? |
Singy 23-Nov-2011 [3983] | C:\Users\Ken\Dropbox\Rebol\rebol.exe -s C:\Users\Ken\Dropbox\Rebol\ping-servers.r |
Pekr 23-Nov-2011 [3984] | try using call/wait/output. Your above code should work though ... |
Singy 23-Nov-2011 [3985x2] | When you use the /input, /output, /error, or /console refinements you automatically set the /wait refinement. -- according to the docs, but I will try it anyway :) |
Tried it - it still hangs, bizarre!! | |
BrianH 23-Nov-2011 [3987] | What's the command in Crimson Editor for running a file of that type? |
Singy 23-Nov-2011 [3988] | C:\Users\Ken\Dropbox\Rebol\rebol.exe -s "$(FilePath)" The intial directory is: $(FileDir) I'm using REBOL 2.7.8.3.1 |
Pekr 23-Nov-2011 [3989] | hmm, I tried call/output "start ping 10.10.10.10 -n 2" tmp: copy "", and R2 hangs too .... |
older newer | first last |