Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 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
Boleslav Březovský
@rebolek
@xmonader I have same problem, I'm on Manjaro (Arch-based distro). What exactly are you doing to triger the segfault? I found problem with libcurl, so I'm curious if there are others.
xmonader
@xmonader
@9214 I used the latest too, ssame thing
@rebolek just calling read, read/info on any url
Boleslav Březovský
@rebolek
@xmonader ok so it's the same libcurl problem. See red/red#2252 and red/red#3402
nedzadarek
@nedzadarek
@9214 they have on-deep-change* but I'm not sure if this have to be used for deep-reactor!s. It might be used for something else... but I don't have time now to check this.
Palaing
@Palaing
@9214 ok I get it. Thanks!
Remigiusz Kozdra
@vejitatoja
I want to create an event that will save the contents of mytext into a file when I'm changing into another tab in tab-panel
How should I do that?
Red [needs: view]

words-as-string: read %words.txt

view [

       Title "Tab-panels"

       tab-panel 200x100 [

               "Tab 1 " [text "First panel"]
               "Tab 2 " [mytext: area 440x215 words-as-string]
       ]
]
dsunanda
@dsunanda
Add an ON-CHANGE to your TAB-PANEL, eg:
 tab-panel  on-change [print ["swapped to tab " event/picked]]
Remigiusz Kozdra
@vejitatoja
on-change fires when changing panels but the unfortunate side effect is that it also fires on every character typed inside mytext area.
Is there any way to make it only react to tab changes?
dsunanda
@dsunanda
Sorry - my mistake. Try ON-SELECT rather than ON-CHANGE
Remigiusz Kozdra
@vejitatoja
on-selectevent also fires on every character typed inside text area but in addition to that also on each mouse click inside text area.
I want to have the ability to automatically save content inside mytext into a file when user will swap to another tab but I want to avoid saving on each keystroke.
Red [needs: view]

words-as-string: read %words.txt

view [

       Title "Tab-panels"

       tab-panel 200x100 on-select [print ["swapped to tab " event/picked]] [

               "Tab 1 " [text "First panel"]
               "Tab 2 " [mytext: area 440x215 words-as-string]
       ]
]
dsunanda
@dsunanda
That's odd - I'm not seeing ON-SELECT respond to anything other than clicking on the tab selections [tab 1][tab 2] - you might have a reportable bug :)
nedzadarek
@nedzadarek
@vejitatoja I think you can check event/picked and save to file depending on that value, something like this:
save-my-text: func [a] [
; just print `text` 
probe a/text
]
view [
    size 400x400
       Title "Tab-panels"

       tab-panel [
               "Tab 1 " [text "First panel" area]
               "Tab 2 " [mytext: area 440x215 return area]
       ] on-change [
        if all [
            event/picked <> 0 ; 0 = selection of non-tab (as fair I can see - no proof!)
            event/picked <> 2 ; 2 is your tab with `mytext` you don't want to save it
            ][  
           save-my-text mytext probe event/picked
                ]
    ] 
]
Remigiusz Kozdra
@vejitatoja
I have discovered that the problem with on-select exist on the new automated build. But it's working correct on old stable red-063.exe It's probably a bug with current version.
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
@vejitatoja
@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
@vejitatoja
@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