AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 5907 |
r3wp | 58701 |
total: | 64608 |
results window for this page: [start: 39801 end: 39900]
world-name: r3wp
Group: View ... discuss view related issues [web-public] | ||
Anton: 18-Sep-2006 | Ok, there is confusion between the layout spec block and the resulting window face. A pattern I use very often: infospec: [ area button ... ] infowin: layout infospec either viewed? infowin [ ; bring the window to the front (or do the taskbar flash thing) infowin/changes: [restore activate] show infowin ][ view/new infowin ] | |
Anton: 19-Sep-2006 | Ok, so remote script looks like: -------------------------- rebol [] info-win: layout [ ...] -------------------------- Local script looks like: -------------------------- rebol [] info-win: do remote-script-url ; Now info-win is a FACE object ; Only do the above line once, otherwise you will create a *new* face and set 'info-win to it, forgetting the old one !! ; The following code is done more than once: either viewed? info-win [ info-win/changes: [restore activate] show info-win ][ view/new info-win ] | |
Anton: 20-Sep-2006 | There is no "scope" in rebol. When you read from a url, you create a new string. That is, READ returns a new string. When you set a word to that new string, you "switch" the word away from its old value (if it had one.) Eg: At the beginning of this example, the word 'info-resp has no value (It is unset!). Now, we set its value to the string returned by READ: info-resp: read url Now, 'info-resp points to a string "[ text ... ]" Let's do it again: info-resp: read url We have re-set 'info-resp to a new string! (even though old string and new string look exactly same.) The old string may still exist as a value somewhere, but 'info-resp does not know about it anymore. Normally this is not a problem. -- However, look at this example: 1) window: layout [box red] 2) view/new window 3) window: layout [box red] 4) unview/only window On line 1, LAYOUT creates a face object which we assign to the word 'window . (So 'window points to a face.) On line 2, VIEW opens the value of 'window as a window. On line 3, LAYOUT creates a *new* face object which we assign to the word 'window. So 'window points to a *new* face, and it has forgotten about the old face. However, the old face is **still open as a window**. So we have lost our reference to the old window face, and it is now more difficult for us to close it. So line 3 has created a problem. On line 4, we try to close the new window face, but we are unsuccessful because the new window face is not open. | |
Janeks: 20-Sep-2006 | Now I believe, that I understood. If it is just a variable with a value, than there is not problem, but layout are not doing just a face value assignment to a variable, but <b>creates new</b> one face and add reference to that face to variable. | |
Anton: 20-Sep-2006 | No, LAYOUT only creates a face. It does not add a reference to a variable. The set-word (eg. info-win: ) takes the value that LAYOUT returns, and associates it with the word (eg. 'info-win ). | |
Anton: 20-Sep-2006 | Actually, I think you understand ok. Yes, LAYOUT creates a *new* face every time. | |
Anton: 20-Sep-2006 | For those creating documentation involving a face hierarchy, here's a function which may help to visualise it: do http://anton.wildit.net.au/rebol/doc/demo-to-3d-layout-image.r | |
Graham: 21-Sep-2006 | Anyone any ideas of how to take a plain paper form and turn it into an electronic form that can have text entered into it and then print it ? | |
Henrik: 21-Sep-2006 | in open office you can create X-forms that can be converted to PDF, opened in adobe reader as a form which then can be printed | |
Graham: 21-Sep-2006 | Looking for a Rebol solution :) | |
Graham: 21-Sep-2006 | So, open office can create a pdf form ? | |
Henrik: 21-Sep-2006 | you'd place it as a background image on the document page and then place the text fields where you want them. | |
Graham: 21-Sep-2006 | So, if you export as pdf... you can then do a search and replace for the prepopulated text and then present this to acrobat? | |
Henrik: 21-Sep-2006 | is the form not meant to be populated manually by a user? | |
Graham: 21-Sep-2006 | yes .. taken from a database | |
Henrik: 21-Sep-2006 | OO.o is capable of taking values from a database and put it in a document, but I'm not sure if those values can be transferred to a PDF form. | |
Graham: 21-Sep-2006 | Starting with Rebol .. I can create a VID form using the scanned jpg as the background. | |
Graham: 21-Sep-2006 | I can then save the completed form as a PNG and print it ... sort of .. | |
Henrik: 21-Sep-2006 | that wouldn't be necessary if you used a VID app to fill out the form, right? | |
Graham: 21-Sep-2006 | So, it would be good to find a solution suitable for an enduser. | |
yeksoon: 21-Sep-2006 | quick question about images. eg. == i1: load %image.jpg i2: i1 i2/size: 300x300 save/png %a.png i2 === why does the image comes out distorted? what is the correct way to 'resize' an image and save it in a different format? | |
yeksoon: 21-Sep-2006 | layout/tight? is there such a refinement? | |
Maxim: 21-Sep-2006 | is there a way to alter the sampling algorythms used in draw? | |
Geomol: 23-Sep-2006 | There should be no legal issue with Independent JPEG Group's version: http://www.ijg.org/ From the README: It appears that the arithmetic coding option of the JPEG spec is covered by patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot legally be used without obtaining one or more licenses. For this reason, support for arithmetic coding has been removed from the free JPEG software. (Since arithmetic coding provides only a marginal gain over the unpatented Huffman mode, it is unlikely that very many implementations will support it.) So far as we are aware, there are no patent restrictions on the remaining code. | |
Geomol: 23-Sep-2006 | I'm not a law expert, so I might be wrong. | |
Henrik: 23-Sep-2006 | I don't think there would be any problems with the law, only a matter of the size of the implementation. | |
Gregg: 23-Sep-2006 | I do believe it was a size issue, Graham. | |
Janeks: 27-Sep-2006 | Not after a button is pressed. | |
Anton: 27-Sep-2006 | Hmm... I will have to test, but I have not tried the web plugin for a long while. Anyone else have it set up ? | |
Anton: 27-Sep-2006 | Probably you only see "Text" in the window. The TEXT has a constant size and the word wrap means that only "Text" can be seen. Try changing to this: | |
Anton: 28-Sep-2006 | I tested the above code with the plugin and it's working for me. There is no good reason why this should not work for you too. (There must only be a bad reason :-) | |
Pekr: 6-Oct-2006 | I have one question from Bobik, to which I don't know an aswer: he's trying to stylize/master his field, but it does not work for him, unless he uses full path in 'engage function, e.g.: system/words/ctx-text/edit-text face event get in face 'action whereas 'field itself does not need full path specified. Why such a difference? Or is he doing anything wrong probably? | |
Volker: 6-Oct-2006 | Theres a trick. feel: make feel bind [..] ctx-edit | |
Volker: 6-Oct-2006 | That style is not written to be probed and pasted. maybe it should. in the source it is inside the right context, so no guru-stuff needed. just a member of an object plugged elsewhere. | |
Anton: 6-Oct-2006 | Here is a quick way to modify the engage function, maybe it does what he wants. view layout [ f: field feel [ engage: func [face act event] head insert copy/deep second :engage [ if (probe event/key) = #"^M" [exit] ] ] ] | |
Pekr: 6-Oct-2006 | well, it seems to insert the code into body of engage which is used for our new engage function as a template, or something like that :-) | |
Anton: 6-Oct-2006 | First it copies the body of engage (copy/deep second :engage). Copying the code this way keeps the binding of all the words. Then it inserts some new code. INSERT leaves us after the insert, so we use HEAD to move back to the head of the block. The copied and modified code is then used as the body of a new engage function. Because we are creating a function using FUNC, the body block is bound to the new function's context, as usual. This means that the 'event word is bound correctly and the new code works correctly. (That's what happens anytime we create a function.) | |
Pekr: 6-Oct-2006 | ok, thanks a lot .... for me the interesting part was 'head ... | |
Pekr: 6-Oct-2006 | func accepts the second argument as a block ... not a block at certain position :-) it should automatically move to the head, but ... maybe not ... | |
Anton: 6-Oct-2006 | Blocks are series and series are fundamental to understanding rebol. You must understand this behaviour and be comfortable with it, because understanding it opens up a lot of the power of series. | |
Anton: 6-Oct-2006 | Here's a different way, which puts the new code in the key handler part: view layout [ field feel [ use [body blk][ body: copy/deep second :engage blk: next find select body [switch act][key] change/only blk compose/only [if event/key <> #"^M" (blk/1)] ?? body engage: func [face act event] body ] ] ] | |
Pekr: 6-Oct-2006 | why is there a difference? >> body: [print "hello"] == [print "hello"] >> f: func [] body >> same? body second :f == false >> probe second :f [print "hello"] == [print "hello"] | |
Anton: 6-Oct-2006 | When you bind a block, eg: bind [all my words] some-context an attempt is made to bind each of the words in the block to the specified context. If the context contains the word in question, then the word is bound, otherwise the word is left with the same binding as it had before. | |
Anton: 6-Oct-2006 | So if I bind [caret: "hello"] system/view then the first word in the block gets the same context as this word: in system/view 'caret and thus it also references the same value, because it is the context which determines what value a word has. | |
Pekr: 6-Oct-2006 | now I seem to understand, just did some small example myself: block: [print a] do block ; 'a is not known my-context: context [a: 1] do bind block my-context ; now 1 is printed | |
Anton: 6-Oct-2006 | And note that it works also for sub-blocks: do bind [print [a]] context [a: 1] | |
Anton: 6-Oct-2006 | Yes, I would prefer more options for binding particular parts of a block "surgically". | |
Pekr: 6-Oct-2006 | hehe, I can rebind whatever, even functions? do bind [print a] context [a: 1 print: :probe] | |
Ladislav: 6-Oct-2006 | I would prefer more options for binding particular parts of a block surgically"" - that is possible e.g. using my BUILD dialect or other instruments... | |
Pekr: 6-Oct-2006 | yes, it seems so ... print: :probe is known only in a newly created context, or so it seems ... | |
Pekr: 6-Oct-2006 | that could easily mean copying all internal state of particular rebol process, right? :-) I wonder is some language makes such a "reflectivity" (probably improper word) possible ... | |
Ladislav: 6-Oct-2006 | what a mess, isn't it? | |
Anton: 6-Oct-2006 | 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. | |
Henrik: 8-Oct-2006 | 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. | |
Henrik: 8-Oct-2006 | pressing a button = pressing a button in an INFORM | |
Gabriele: 9-Oct-2006 | basically, inform does a new wait [] | |
Gabriele: 9-Oct-2006 | wake-event behaves differently when there is a popup open | |
Gregg: 12-Oct-2006 | 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. | |
Gregg: 12-Oct-2006 | Yes! That was a way cool app. | |
Louis: 14-Oct-2006 | Has anyone written a "How to debug REBOL/View" doc? | |
Graham: 14-Oct-2006 | without seeing the relevant part it may be that the problem is that your style references a field which has not been defined yet. | |
Anton: 14-Oct-2006 | 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 ] | |
Anton: 14-Oct-2006 | 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. | |
Anton: 14-Oct-2006 | By the way, to-string already makes a copy. >> same? (to string! str: "example") str == false | |
Louis: 14-Oct-2006 | I'm learning a lot tonight. Thanks. | |
Robert: 15-Oct-2006 | 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 | an easy way is to keep all labels in a panel and then traverse the pane and set the label texts on a label. | |
Anton: 15-Oct-2006 | 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* | |
Louis: 16-Oct-2006 | What I want is: 1. The exchange rate to be saved in a file, so that it will always be loaded upon start the script. 2. The exchange rate to remain in the field through each loop of view. 3. And, of course, I want to be able to change the exchange rate if needed. Seems like it should be a common easy thing to do, but it eludes me. | |
MikeL: 16-Oct-2006 | Louis, I haven't been following this problem but if you want to just load a rate from a text file you could do something like this which handles loading before showing the face and allows saving an updated rate REBOL [] these-styles: stylize [ lab: label 60x20 right bold middle font-size 11 fld: field 60x20 font-size 11 middle edge [size: 1x1] ] rate-file: %/c/rate-file.txt if not exists? rate-file [write rate-file 1.000] rate: load rate-file view layout [ across styles these-styles lab "Rate" rate-field: fld bold (form rate) return btn "Save" #"^s" [save rate-file form rate-field/text] ] | |
Louis: 16-Oct-2006 | rebol [] either exists? %exchange-rate.txt [ exchange-rat: load %exchange-rate.txt ][ save %exchange-rate.txt 1 exchange-rat: load %exchange-rate.txt ] exchange-rate-style: stylize [ exchange-rate-label: label 60x20 right bold middle exchange-rate-field: field 270x24 middle ] view layout [ styles exchange-rate-style exchange-rate-label "Rp/US$:" exchange-rate: exchange-rate-field bold (form exchange-rat) button "Save" [ save %exchange-rate.txt exchange-rate/text ] ] The above code works in the above test script (mimics MikeL's script); but in my accounting script it yields and error message: ** Script Error: val needs a value ** Where: forskip ** Near: forall args [ val: first args switch/default type?/word val [ pair! [append pairs val] integer... >> | |
Graham: 16-Oct-2006 | this includes a lot of redundant code | |
Graham: 16-Oct-2006 | if not all [exists? %exchange-rate.txt "" <> exchange-rat: read %exchange-rate.txt][ write %exchange-rate.txt exchange-rat: "1" ] is a little shorter again | |
Louis: 16-Oct-2006 | Ok, I have 61 out of 63 fields to clear, so it would be a lot easier to deal with those two that don't have to be cleared than to deal with the 61 that must be. So I propose a modification to the clear-fields function: Here is the source: clear-fields: func [ "Clear all text fields faces of a layout." panel [object!] ][ if not all [in panel 'type panel/type = 'face] [exit] unfocus foreach face panel/pane [ if all [series? face/text flag-face? face field] [ clear face/text face/line-list: none ] ] ] | |
Louis: 16-Oct-2006 | I would just like to put the panes I don't want to be cleared into a block; all the rest would be cleared. | |
Louis: 16-Oct-2006 | It is just logical that this function has such a refinement. | |
Louis: 16-Oct-2006 | Oh, the source above is what needs to be modified, not my modification. The only reason I posted it is to show how simple it is, and therefore how easy it should be to add a refinement to it. | |
Louis: 17-Oct-2006 | I''m working on this myself. My first question: How can evaluation be based on the name of a field, and thus not on the contents of the field? If the name of the field is this then do that. | |
Sunanda: 17-Oct-2006 | Does this do what you want? clear-fields: func [ "Clear all text fields faces of a layout." panel [object!] /except exceptions [block!] ][ if not all [in panel 'type panel/type = 'face] [exit] unfocus if not block? exceptions [exceptions: copy []] exceptions: reduce exceptions foreach face panel/pane [ if all [series? face/text flag-face? face field not find exceptions face] [ clear face/text face/line-list: none show face ] ] ] ;; test/ example l-o: layout [ a: field "A" b: field "B" c: field "C" button "clear c" [ clear-fields/except l-o [a b] ] button "clear a" [ clear-fields/except l-o [b c] ] ] unview/all view l-o | |
Louis: 17-Oct-2006 | Sunanda, thanks! That works perfectly. Your refinement made what would have been a big job into a minor task that took only a few seconds. In my opinion, this refinement definately needs to be in Rebol 3. I will make newbies much happier. | |
Anton: 18-Oct-2006 | Louis, just catching up with your post back on Monday, I wanted to say that it's a bit odd to use the FEEL to do init code. It's not really intended for that. A way to do custom init code is like this: layout [ field with [ append init [ ; custom init code here text: exchange-rat ] ] ] and in the above case, just setting the text facet, it simplifies to: layout [ field (exchange-rat) ] | |
Louis: 18-Oct-2006 | I just downloaded it a few minutes ago. | |
Henrik: 18-Oct-2006 | what does it say when you try that line? maybe it's a faulty proxy | |
Anton: 18-Oct-2006 | Henrik, thanks for trying. I could go through the usual rigmarole of determining the error (which is quite apparent to me from the above error message. That's my old website, at Lexicon.) *But* I am proud to announce a new include system !! Give this a try: | |
Sunanda: 18-Oct-2006 | Louis <What is the best way to submit this to RT?> Add it as an enhancement request to Rambo: http://www.rebol.net/cgi-bin/rambo.r And thanks for testing the code -- glad it worked.......One enhancemnet suggestion: you may not need the individual "show face" lines if you have a show layout-name at the end. | |
Anton: 18-Oct-2006 | Well, it's now over four and a half years since I began with include systems. The first version of the old include system was 17-Feb-2002. | |
Graham: 19-Oct-2006 | when working with Vid data structures .. it makes sense to me to perhaps to create functions that act on a vid widget to be associated with that widget | |
Graham: 19-Oct-2006 | So, if you have a complex large program, you can keep all the functions that act upon/with a widget's data all in one place. | |
Maxim: 20-Oct-2006 | do you mean like creating a style and specifiying the with block? view layout [ style button button with [ print-lbl: func [][print self/text] ] button "do" [face/print-lbl] ] | |
Graham: 20-Oct-2006 | Your example uses a style ... | |
Graham: 20-Oct-2006 | You might have multiple functions that operate on the widget and you want to hide them as a type of context inside the widget | |
Maxim: 20-Oct-2006 | you don't need to make a style for the with block. I just did this cause I thought you meant that you want the functions to be applied to a broad set of gadgets. this works directly: view layout [ button "do" [face/print-lbl] with [ print-lbl: func [][print self/text] ] ] | |
Maxim: 20-Oct-2006 | basically the with block is like when you supply a block to something like make face! [] | |
Maxim: 20-Oct-2006 | yes, I am a slavemaster to VID. | |
Maxim: 20-Oct-2006 | is there a sure-fired way to know if a face is currently shown? I don't remember from the top of my head... anyone? | |
Maxim: 20-Oct-2006 | I don't see that as being a word within the face. could it be show? | |
Graham: 20-Oct-2006 | >> help viewed? USAGE: VIEWED? face DESCRIPTION: Returns TRUE if face is displayed. VIEWED? is a function value. ARGUMENTS: face -- (Type: object) | |
Anton: 20-Oct-2006 | Ah.. but you will basically need to make a function similar to find-window in order to be sure everything's ok. | |
Anton: 20-Oct-2006 | Yes, you will need to check if parent-face is none. face/parent-face is only set the first time a face is shown. | |
Anton: 20-Oct-2006 | So you want to redraw a face, while respecting its show? facet, I suppose. |
39801 / 64608 | 1 | 2 | 3 | 4 | 5 | ... | 397 | 398 | [399] | 400 | 401 | ... | 643 | 644 | 645 | 646 | 647 |