World: r3wp
[Rebol School] Rebol School
older newer | first last |
todun 5-Oct-2011 [3887] | @Kaj, ok. So I can just write all my VIEW as a function. Repeat the same for Model and CONTROLLER? How will I then combine them? |
Kaj 5-Oct-2011 [3888x2] | A view is typically a template. In REBOL, it would be a piece of View dialect |
Model and controller would be functions, that you can then connect to the View GUI | |
todun 5-Oct-2011 [3890x3] | @Kaj, thanks. This is begining to make sense. The view is like a template, something static the user will see. The MODEL, is a function, the controller coordinates with Model and View somehow. |
@Kaj, I've not used MVC much myself, but the rumor out there is that it's one way to go. So when you say connect them, what do you mean? | |
@Kaj, Also, when I have a Model with multiple parts that are best represesnted as functions themselves, how can I make it available to the view(these "sub-functions")? | |
Kaj 5-Oct-2011 [3893x4] | What you call idiom would mostly be the View dialect. That's specifically for specifying GUIs |
The GUI dialect has places for actions. That's where your model and controller functions would go | |
For simple programs, that code is often so small that we tend to write it out directly in the GUI dialect | |
If you have little experience with all the forms of MVC, it's better to forget it and just follow the REBOL tutorials | |
todun 5-Oct-2011 [3897x2] | @Kaj, can you point me to a sample program that has these features you speak of? |
Kaj, I have looked at several REBOL tutorialss and I cannot seem to be able to make them do exactly what I wanted, hence my pining for a paradigm like MVC. | |
Kaj 5-Oct-2011 [3899] | No, as I say, we don't usually use MVC as such. Any View example shows how to specify some GUI with some actions |
todun 5-Oct-2011 [3900] | @Kaj, oh I see. So an action like an Alert? |
Kaj 5-Oct-2011 [3901x2] | Perhaps, but an alert usually has its own little dialog GUI |
Actions within the GUI dialect are regular REBOL code, so they can be anything | |
todun 5-Oct-2011 [3903] | @Kaj, ok. do you have an example in mind? |
Kaj 5-Oct-2011 [3904] | Please follow the many tutorials linked from the REBOL site |
todun 6-Oct-2011 [3905x3] | @Kaj: Ok thanks. |
is there a way to add 5 to a variable anytime it is called? for example x: 0 .... counter: x + 5 | |
so everytime I call counter it should result in 5, 10, ... | |
Geomol 6-Oct-2011 [3908] | >> counter: does [x: x + 5] >> x: 0 == 0 >> counter == 5 >> counter == 10 Or do I misunderstood? |
todun 6-Oct-2011 [3909] | @Geomol, thanks. That is perfect. |
Geomol 6-Oct-2011 [3910] | Anyway, pretty much everything is possible in REBOL, so just specify as precise as you can, what you want, and someone will come up with an idea how to do it. |
todun 6-Oct-2011 [3911x2] | @Geomol, good to know. thanks. |
What does a misplaced item error mean? I get it when I try to read a file like so: lines: read/lines %file.txt | |
Geomol 6-Oct-2011 [3913] | Maybe there are some strange data in the file? |
Pekr 6-Oct-2011 [3914] | todun - a little bit more dynamic version of counter: counter: func ['var add-value][if not value? var [set var 0] set var (get var) + add-value] counter x 10 ; --- x does not have to exist, and if is inicialised and set to 0 |
todun 6-Oct-2011 [3915x3] | @Pekr, thanks. Will see if that can fit into my implementation. |
@Geomol, no. This worked before. | |
Can I post code here or something so you can see what I'm doing right or wrong? | |
Geomol 6-Oct-2011 [3918] | A mistake is sometimes, that part of REBOL was changed, as everything can be redefined. If that's the case, you can try restart REBOL and see, if the error is still there. And yes, you can post code, but most don't like it, if it's too long. |
todun 6-Oct-2011 [3919] | @Geomol, how many lines is too long? |
Geomol 6-Oct-2011 [3920] | :D Post along! |
todun 6-Oct-2011 [3921x2] | @Geomol, restarting rebol didn't me. |
button-press?: layout [ lines: read/lines %question-list.txt current-position: 1 ; len: length? lines show-one: btn "Show answer" [ one-position: ++ current-position line: pick lines one-position result/text: line show result ] show-soon: btn "Soon" [ soon-position: does [current-position: current-position + 5] line: pick lines soon-position result-soon/text: line show result-soon ] result: info " " result-soon: info " " ] | |
Geomol 6-Oct-2011 [3923x2] | Uh, I think, you make the mistake, that the interiour of the LAYOUT block is actually a dialect. You put all kind of code in it. |
The dialect is called VID in this case. Read: http://www.rebol.com/docs/view-guide.html | |
Pekr 6-Oct-2011 [3925] | It would be probably better if you would describe what you want to do, then someone might write the code right from the scratch :-) |
Geomol 6-Oct-2011 [3926x3] | We all went through those times, where we needed to realize, what dialects are, so don't give up. |
A quick guess would be, that the code will work, if you put DO [ ... ] around the code in the beginning of the block after LAYOUT. | |
DO in the VID dialect is described here: http://www.rebol.com/docs/view-guide.html#section-44 | |
todun 6-Oct-2011 [3929x2] | @Geomol, @Pekr, thanks. I am trying to make flashcard display. However I want to do it myself so that I see all the places where I hiccuped. |
what do I need to do to make it in the VID dialect? | |
Geomol 6-Oct-2011 [3931] | Try change your block so it starts: button-press?: layout [ do [ lines: read/lines %question-list.txt current-position: 1 ; len: length? lines ] ... |
todun 6-Oct-2011 [3932x2] | @Geomol, when I call the file in the CLI, I use do |
DO | |
Geomol 6-Oct-2011 [3934] | Sure, but that's another DO. :) Think dialects. I know, it's hard at first. |
todun 6-Oct-2011 [3935] | @Geomol, what about dialects ? |
Geomol 6-Oct-2011 [3936] | What does the english word "book" mean? Is it "a book" you can read in, or is it "book a ticket". You see, the same word can mean more than one thing. Same in REBOL. |
older newer | first last |