Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 2019 22:59
    @dockimbel banned @SmackMacDougal
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
Toomas Vooglaid
@toomasv
@vejitatoja Try defining on-select ['done] for area to stop event propagation.
nedzadarek
@nedzadarek
ps. it seems that on-change (and probably more events) are "overreacting". With slider it triggers the on-change even you only click (not changing) on the slider: view [s: slider on-change [print s/data]].
Toomas Vooglaid
@toomasv
@vejitatoja
view [
    Title "Tab-panels"
    tab-panel 200x100 on-change [print ["face/selected:" face/selected "event/picked:" event/picked]] [
        "Tab 1 " [text "First panel"]
        "Tab 2 " [mytext: area 440x215 "Lorem ipsum dolor sit amet, consectetur adipiscing elit." on-change ['done]]
    ]
]
Gregg Irwin
@greggirwin
Another approach is to see if the tab panel is the actual face getting the event.
view [
       Title "Tab-panels"

       tp: tab-panel 200x100 [
               "Tab 1 " [text "First panel"]
               "Tab 2 " [mytext: area 440x215 words-as-string]
       ] on-change [
       if event/face = tp [
            print ["real tab event" "swapped to tab " event/picked]
       ]
       ]
]
If we can dupe the on-select issue, we can file it as a regression. I think there have been some changes there, with panel dragging being fixed up.
Remigiusz Kozdra
@Re-git
@toomasv Thanks, Your solution works on the current build. If i understand correctly second on-change that is added for area overrides the top level one? The only issue is that it would mean that i would need to add on-select ['done] to all of the faces that are children of tab-panel.
Remigiusz Kozdra
@Re-git
@greggirwin That works. I will go with that solution. Thank you.
Gregg Irwin
@greggirwin
:+1:
nedzadarek
@nedzadarek

@GiuseppeChillemi

is /:ind the same of /(ind) ?

Not exactly. ind in the in the :ind is a word - it is a final value, that you want to look for in the series. (...) is a paren! - you can compute "final value" here. Examples:

arr: [a 11 "b" 22]

ind: 'a
arr/:ind
arr/(ind)
arr/('a)
arr/a

ind: "b"
arr/:ind
arr/(ind)
arr/(back tail "cb")
nedzadarek
@nedzadarek
  • about :ind - I mean word that refers to a final value.
GiuseppeChillemi
@GiuseppeChillemi
@nedzadarek
Some more questions. In RED:
arr: [a 11 "b" 22]
ind: to-lit-word "a"

>> probe arr/:ind
== 11
>> probe arr/(ind)
11
IN REBOL:
>> probe arr/:ind
** Script Error: Invalid path value: a
** Where: halt-view
** Near: probe arr/:ind

>> probe arr/(ind)
11
== 11
nedzadarek
@nedzadarek
@GiuseppeChillemi in the Red, it seems that they added get-word! (:word) select on other values as well.
ps. in the Rebol: arr: [11 22 33] ind: 1 arr/:ind; =11
Vladimir Vasilyev
@9214
@GiuseppeChillemi @nedzadarek get-word! has nothing to do with it
>> block: [a 11 b 22]
== [a 11 b 22]
>> block/(probe quote 'a)
'a
== 11
>> block/(probe to lit-word! "a")
'a
== 11
nedzadarek
@nedzadarek
@9214 I mean get-word! in a path!like <word>/<get-word!> e.g. arr/:ind. I do not mean syntax with a paren!: <word!>/<paren!> e.g. arr/(ind).
And I am not sure how your example relate to the Rebol not being able to get value by <word>/<get-word!> but it can do it with <word!>/<paren!>.
Vladimir Vasilyev
@9214
lit-word! acts as a key selector, not paren! or get-word!, gee.
nedzadarek
@nedzadarek

@9214
1) Both languages can get value based on a number: arr/1.
2) Both languages can get value based on a word: arr/info.
3) Both languages can get value using paren! based on a number/word: arr/(0 + 1), arr/('info).
4) Only the Red can get value based on both a number and a word using get-word!: arr/:w where w is a word or a number.

So based on 3 paren! can acts as numeric/word selector (value from a paren!).
Based on 4 the Rebol has the "problem" with getting value from a get-word!.

In my opinion get-word! is in the centre of the problem.

Vladimir Vasilyev
@9214
@nedzadarek if you'd read original error message more carefully, you'd noticed that get-word! evaluates correctly, but Rebol fails to interpret lit-word! as a valid selector. Red in this case correctly coerces all any-word! values. So, no, problem is not with get-word!, problem is with lit-word! (or any other possible any-word! value) to which it evaluates. Same holds for paren! expressions - they are not selectors, but the result of their evaluation is.
nedzadarek
@nedzadarek

@9214

** Script Error: Invalid path value: a
** Near: probe arr/:ind

Yes, it seems that get-word! evaluates correctly but it seems that we cannot use word! as path's value. "invalid path value: a" - I assume that a is a word! here... but it can be lit-word! as well. In my opinion that error message is not as clean as you said.
Putting that aside, this answer fully explain differences. Thank you for this.

nedzadarek
@nedzadarek

Hmmm... so this is where /same refinement is useful:

arr: [a "word" 'a "lit-word" :a "get-word" a: "set-word"]
select/same arr to-get-word 'a
; == "get-word"

I guess we cannot do this using path!?

Gabriele Santilli
@giesse
@nedzadarek I think you are not reading what @9214 is writing.
REBOL/Core 2.7.6.4.2 (14-Mar-2008)
[...]
>> b: [a 1 b 2 c 3]
== [a 1 b 2 c 3]
>> b/a
== 1
>> x: 'a
== a
>> b/:x
== 1
nedzadarek
@nedzadarek
@giesse but I understand why Red can get value using lit-word! and the Rebol cannot.
Incendi
@Incendi
Hi, is anyone using red 0.6.3 on Ubuntu 18.04?
Boleslav Březovský
@rebolek
@Incendi Hi, I do.
Incendi
@Incendi
Hi, I'm interested in trying a Red but have a libcurl3 dependency issue
I'm sure you had to overcome that?
Boleslav Březovský
@rebolek
@Incendi Yes (I'm on Manjaro now, I have Ubuntu on other computer that I can't access right now, so I have to help you from memory). Do you have 32bit libraries installed, right?
Incendi
@Incendi
No. I don't think so at least because when I try to apt-get install libcurl3:i386 it wants to Uninstall libcurl4 and everything that depends on that :(
Boleslav Březovský
@rebolek
IIRC, just ignore libcurl3 and install libcurl4:i386
Incendi
@Incendi
Doing it. One moment
Brilliant! The Red console is running. Just ran my first line of code in it
Boleslav Březovský
@rebolek
@Incendi :clap: Happy Reducing! If you have any questions feel free to ask!
Incendi
@Incendi
Thank you so much :)
Toomas Vooglaid
@toomasv
How to convert Windows crlf-s into Unix lf-s in a string?
Boleslav Březovský
@rebolek
you can do replace/all
on binary of course
because Red does the conversion automatically based on your platform
replace/all read/binary file crlf lf
Toomas Vooglaid
@toomasv
@rebolek Thanks! My problem is that area/selected seems not to take Win into account, so newlines are counted as two chars.
Boleslav Březovský
@rebolek
@toomasv interesting, I guess it should be reported.
BeardPower
@BeardPower
Ah, that nasty line-ending stuff. I wished there was finally some standard!
Boleslav Březovský
@rebolek
there is. and not only one, you can choose your favorite!
Boleslav Březovský
@rebolek
I don't even have to click on it :D
BeardPower
@BeardPower
Hehe ;-)
Toomas Vooglaid
@toomasv
image.png
nedzadarek
@nedzadarek

How do you deal with time-consuming computation in the gui?

make-random-image: has [img ] [
  img: make image! 200x200 
  forall img [img/1: random 255.255.255] 
  wait 2 img
]
view [i: image [i/image: make-random-image]]

Let's suppose that make-random-image just takes at least 2 seconds to compute. In those 2 seconds I'm left with unresponsive window. Is there anything I can do to make user experience better such in cases?
ps. I know about memoization and I'm not sure if I can translate this part of code to Red/System.

Boleslav Březovský
@rebolek
You can always run another process.
nedzadarek
@nedzadarek
@rebolek from within the Red? How?