Skip to content

Instantly share code, notes, and snippets.

@toomasv
Created June 22, 2022 18:12
Show Gist options
  • Save toomasv/df04e859aea1f1fd0e6920efb0d682d9 to your computer and use it in GitHub Desktop.
Save toomasv/df04e859aea1f1fd0e6920efb0d682d9 to your computer and use it in GitHub Desktop.
Bind slice of block
Red [
Needs: 'View
Problem: "[June 22, 2022 1:41 PM](https://gitter.im/red/red?at=62b2f1c8d3c8894f7198cf95)"
]
bind-part: function [what where with][
yep: false
beg: where/1
fin: where/2
parse what [any [s:
if (s/1 = fin) thru end
| if (s/1 = beg) skip (yep: true)
| if (all [yep attempt [with/(s/1)]]) change skip (bind s/1 with)
| skip
]]
]
ctx-config: make object! [size: 200x100 display-text: "Hello Word"]
panel: [
txt1: text yellow display-text size
txt2: text sky display-text size
txt3: text pink display-text size
]
bind-part panel [txt1: txt2:] ctx-config
bind-part panel [txt2: txt3:] make ctx-config [display-text: "Dear"]
bind-part panel [txt3: 'end] make ctx-config [size: 200x200 display-text: "Red Programmers"]
view panel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment