World: r3wp
[Rebol School] Rebol School
older newer | first last |
todun 5-Oct-2011 [3874] | @Kaj, I have no idea what the conventions are here or what all the different rooms mean. I assumed that my questions in "I'm new" were not meeting the requiremetns of the room so I posted here. Sorry if I'm tresspasing on some rule here. |
Henrik 5-Oct-2011 [3875] | we usually simply say "let's talk in group X", if a specific topic is inappropriate for the current group. |
todun 5-Oct-2011 [3876x3] | @Henrik, thanks for the tip. |
@PeterWood, ok. thanks. I will try that. | |
how can I do MVC(Model View Controller) in REBOL? Thanks. | |
Kaj 5-Oct-2011 [3879] | Look in the !QM QuarterMaster group here |
todun 5-Oct-2011 [3880] | @Kaj: do I repost the question there or is this information someplace online? |
Kaj 5-Oct-2011 [3881] | The answer is in there, so I don't think you'll have to repost :-) |
todun 5-Oct-2011 [3882] | @Kaj, I just reposted. Oops. |
Kaj 5-Oct-2011 [3883] | It's a good approach to want to design a first REBOL GUI program in MVC parts, but I think you'll find when you fit them together, that the resulting code would blend together. We don't really talk in MVC terms about View code |
todun 5-Oct-2011 [3884] | @Kaj, what is idiomatic REBOL to approach my problem? How do I make sense of it? |
Kaj 5-Oct-2011 [3885x2] | There's not much idiom for this, like in general in functional languages, because for such a small program, not much code is needed in REBOL |
Just write the three MVC parts and then fit them together | |
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 [3923] | 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. |
older newer | first last |