[REBOL] Re: view indirection
Thanks Ingo Another great answer from the rebol-list. I have just tested it. However trying to understand more, I crash my windows with a probe. Here is my code. The probe thing is in the guru-function. Thanks again Rebol [] guru-function: func [ s [string!] n [integer!] /local mc][ mc: get to-word join s n ; print probe mc -- freeze my windows 2000 mc/data: true show mc ] view center-face layout [ banner Test c1: check c2: check c3: check c4: check button Test [guru-function c 3] button that's all folks ! [unview] ] - Original Message - From: Ingo Hohmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 7:43 PM Subject: [REBOL] Re: view indirection Hi Patrick, Once upon a time Patrick Philipot spoketh thus: set-check: func [n [integer!] /local code ][ code: copy code: join join set in c n join 'data true show c n print [generated code ; code] do code ] IT IS WORKING ! (the print is only for debugging purpose). However I am not satisfied with this code. I'am looking for a more elegant way to do that. Something like : myCheckBox: guru-function( c 5) myCheckbox/data: true how about that one? c1: make object! [data: none] probe c1 make object! [ data: none ] guru-function: func [ s [string!] n [integer!]][ [ get to-word join s n [] mc: guru-function c 1 mc/data: yup == yup probe c1 make object! [ data: yup ] And how 'guru-function works: 'join the string (s) and the integer (n) make a word out of it and get what you find under that word (without the 'get it would only return the name of the word 'c1, namely a word c1. With 'get, it returns the object!, c1 points too). I hope that helps Ingo -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes. -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes.
[REBOL] Re: view indirection
Hi Sterling This is clean and elegant. Thanks to the rebol-list, I have now many ways to perform the required task with style ! Thanks again Patrick - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 7:13 PM Subject: [REBOL] Re: view indirection Here's another option: Make a list of the checkboxes either directly: checks: reduce [c1 c2 c3 c4 ...] or iteratively: checks: copy [] repeat x 16 [append checks to-word join c x] reduce checks Now when you need to access one: set-check: func [n [integer!]] [ checks/:n/data: true show checks/:n ] Or to just improve on what you've got below: set in wrd: get to-word join c n 'data true show wrd The only thing you really need to build dynamically is the word to reference the checkbox. The rest of the REBOL code can stay as REBOL code. Sterling Hi, I am stuck in a should-not-be-so-difficult problem with view. I have a lot of checkboxes in a layout, named c1, c2, ... c16. At one time, given a number X, I would like to do something on the cX checkbox. For now, I have this sort of code : set-check: func [n [integer!] /local code ][ code: copy code: join join set in c n join 'data true show c n print [generated code ; code] do code ] IT IS WORKING ! (the print is only for debugging purpose). However I am not satisfied with this code. I'am looking for a more elegant way to do that. Something like : myCheckBox: guru-function( c 5) myCheckbox/data: true Patrick -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes. -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes.
[REBOL] Re: view indirection
Hi Ryan That's working. However I don't understand what is user-data. Could you explain it to me . Thanks Patrick - Original Message - From: Ryan Cole [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 6:48 PM Subject: [REBOL] Re: view indirection Hello, I am assuming the following wont work because you need to loop through your checkboxes: C5/data: true I would consider somthing like this more elegant... win: view/new layout [check user-data 1 check user-data 2 check user-data 5] set-check: func [number value] [ repeat index length? win/pane [ if win/pane/:index/user-data = number [ win/pane/:index/data: value ] ] value ] But its said Beauty is in the eye of the beholder. --Ryan Patrick Philipot wrote: Hi, I am stuck in a should-not-be-so-difficult problem with view. I have a lot of checkboxes in a layout, named c1, c2, ... c16. At one time, given a number X, I would like to do something on the cX checkbox. For now, I have this sort of code : set-check: func [n [integer!] /local code ][ code: copy code: join join set in c n join 'data true show c n print [generated code ; code] do code ] IT IS WORKING ! (the print is only for debugging purpose). However I am not satisfied with this code. I'am looking for a more elegant way to do that. Something like : myCheckBox: guru-function( c 5) myCheckbox/data: true Patrick -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes. -- Ryan Cole Programmer Analyst www.iesco-dms.com 707-468-5400 The contradiction so puzzling to the ordinary way of thinking comes from the fact that we have to use language to communicate our inner experience which in its very nature transcends lingistics. -D.T. Suzuki -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes. -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes.
[REBOL] Re: view indirection
Hi Patrick, From WordNet (r) 1.7 [wn]: (shortened!) probe n 1: an inquiry into unfamiliar or questionable activities; there was a congressional probe into the scandal v 1: question or examine thoroughly and closely Once upon a time pat665, french new rebolist spoketh thus: Thanks Ingo Another great answer from the rebol-list. I have just tested it. However trying to understand more, I crash my windows with a probe. Here is my code. The probe thing is in the guru-function. Thanks again Rebol [] guru-function: func [ s [string!] n [integer!] /local mc][ mc: get to-word join s n ; print probe mc -- freeze my windows 2000 mc/data: true show mc ] Now, mc at the time is a view face, and these are BIG! Probing them is like trying to cut a whale in half, using a nail-file. That said, running this code needs about 15s until the first probe output is shown, and about the same time until it's run through. I'm on a PIII 900, Linux, how long did _you_ wait? ;-) Kind regards, Ingo -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes.
[REBOL] Re: view indirection
Wow ! It tooks Rebol almost seven minutes to throw it up on my Pentium 200 Mhz. Thanks for this valuable lesson. Patrick - Original Message - From: Ingo Hohmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 21, 2001 4:27 PM Subject: [REBOL] Re: view indirection Hi Patrick, From WordNet (r) 1.7 [wn]: (shortened!) probe n 1: an inquiry into unfamiliar or questionable activities; there was a congressional probe into the scandal v 1: question or examine thoroughly and closely Once upon a time pat665, french new rebolist spoketh thus: Thanks Ingo Another great answer from the rebol-list. I have just tested it. However trying to understand more, I crash my windows with a probe. Here is my code. The probe thing is in the guru-function. Thanks again Rebol [] guru-function: func [ s [string!] n [integer!] /local mc][ mc: get to-word join s n ; print probe mc -- freeze my windows 2000 mc/data: true show mc ] Now, mc at the time is a view face, and these are BIG! Probing them is like trying to cut a whale in half, using a nail-file. That said, running this code needs about 15s until the first probe output is shown, and about the same time until it's run through. I'm on a PIII 900, Linux, how long did _you_ wait? ;-) Kind regards, Ingo -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes. __ ifrance.com, l'email gratuit le plus complet de l'Internet ! vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP... http://www.ifrance.com/_reloc/email.emailif -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes.
[REBOL] Re: view indirection
Hello, I am assuming the following wont work because you need to loop through your checkboxes: C5/data: true I would consider somthing like this more elegant... win: view/new layout [check user-data 1 check user-data 2 check user-data 5] set-check: func [number value] [ repeat index length? win/pane [ if win/pane/:index/user-data = number [ win/pane/:index/data: value ] ] value ] But its said Beauty is in the eye of the beholder. --Ryan Patrick Philipot wrote: Hi, I am stuck in a should-not-be-so-difficult problem with view. I have a lot of checkboxes in a layout, named c1, c2, ... c16. At one time, given a number X, I would like to do something on the cX checkbox. For now, I have this sort of code : set-check: func [n [integer!] /local code ][ code: copy code: join join set in c n join 'data true show c n print [generated code ; code] do code ] IT IS WORKING ! (the print is only for debugging purpose). However I am not satisfied with this code. I'am looking for a more elegant way to do that. Something like : myCheckBox: guru-function( c 5) myCheckbox/data: true Patrick -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes. -- Ryan Cole Programmer Analyst www.iesco-dms.com 707-468-5400 The contradiction so puzzling to the ordinary way of thinking comes from the fact that we have to use language to communicate our inner experience which in its very nature transcends lingistics. -D.T. Suzuki -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes.
[REBOL] Re: view indirection
Here's another option: Make a list of the checkboxes either directly: checks: reduce [c1 c2 c3 c4 ...] or iteratively: checks: copy [] repeat x 16 [append checks to-word join c x] reduce checks Now when you need to access one: set-check: func [n [integer!]] [ checks/:n/data: true show checks/:n ] Or to just improve on what you've got below: set in wrd: get to-word join c n 'data true show wrd The only thing you really need to build dynamically is the word to reference the checkbox. The rest of the REBOL code can stay as REBOL code. Sterling Hi, I am stuck in a should-not-be-so-difficult problem with view. I have a lot of checkboxes in a layout, named c1, c2, ... c16. At one time, given a number X, I would like to do something on the cX checkbox. For now, I have this sort of code : set-check: func [n [integer!] /local code ][ code: copy code: join join set in c n join 'data true show c n print [generated code ; code] do code ] IT IS WORKING ! (the print is only for debugging purpose). However I am not satisfied with this code. I'am looking for a more elegant way to do that. Something like : myCheckBox: guru-function( c 5) myCheckbox/data: true Patrick -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes.
[REBOL] Re: view indirection
Hi Patrick, Once upon a time Patrick Philipot spoketh thus: set-check: func [n [integer!] /local code ][ code: copy code: join join set in c n join 'data true show c n print [generated code ; code] do code ] IT IS WORKING ! (the print is only for debugging purpose). However I am not satisfied with this code. I'am looking for a more elegant way to do that. Something like : myCheckBox: guru-function( c 5) myCheckbox/data: true how about that one? c1: make object! [data: none] probe c1 make object! [ data: none ] guru-function: func [ s [string!] n [integer!]][ [ get to-word join s n [] mc: guru-function c 1 mc/data: yup == yup probe c1 make object! [ data: yup ] And how 'guru-function works: 'join the string (s) and the integer (n) make a word out of it and get what you find under that word (without the 'get it would only return the name of the word 'c1, namely a word c1. With 'get, it returns the object!, c1 points too). I hope that helps Ingo -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes.