Is it possible to code something that can edit the coding within the system browser? Maybe a "replace method []'s coding with [] block" or a "make new method with coding []" block. The goal is to make a "make a new block with blockspec [] and coding []" block.
Offline
Hardmath123 wrote:
Is it possible to code something that can edit the coding within the system browser? Maybe a "replace method []'s coding with [] block" or a "make new method with coding []" block. The goal is to make a "make a new block with blockspec [] and coding []" block.
thats what we're developing for Rocket!
Offline
If we figured this out then Scratch blocks in the Library could be downloadable the same way as Panther!
Don't forget (coding of [])
Offline
Ehm, is this succeeding?
I've tried to look for this code for ages, and failed!!!
Please, if there's any news, tell me.
Offline
I would do it this way.
Have a new set of block specs (new method) and a Ordered Collection (Smalltalk 1080's - squeak - list ). Then have a default set out for each type of block (reporter, standard, boolean and so on). When the user creates a block it add's the code to the list (Ordered Collection) and then edits the default layout and modifies the block spec.
Ordered Collection info.
Last edited by johnnydean1 (2011-04-26 10:40:11)
Offline
johnnydean1 wrote:
I would do it this way.
Have a new set of block specs (new method) and a Ordered Collection (Smalltalk 1080's - squeak - list ). Then have a default set out for each type of block (reporter, standard, boolean and so on). When the user creates a block it add's the code to the list (Ordered Collection) and then edits the default layout and modifies the block spec.
Ordered Collection info.
That's a great (but still complicated) solution for the posts issue, but I'd still be interested in the editing code...
Offline
I can get it working, if (its a big if) anyone can figure out 2 things.
set a variable to a single ' (1 quote mark)
and find a way of inserting variables into #() type lists.
Offline
Hmmm, setting a variable to a single quote seems impossible. What you can do is make a block 'set variable to []' and input a single quote.
Also, adding to #() lists should be possible by exploring the variable list. That basically adds to the list, too.
Last edited by Hardmath123 (2011-04-27 02:51:44)
Offline
Hardmath123 wrote:
Hmmm, setting a variable to a single quote seems impossible. What you can do is make a block 'set variable to []' and input a single quote.
Also, adding to #() lists should be possible by exploring the variable list. That basically adds to the list, too.
Well if it works, then its quite simple.
Offline
Untested but probably working code:
setMethodSource: t1 category: t2 | t3 | t3 _ PluggableTextController new. ScriptableScratchMorph compile: t1 classified: t2 notifying: t3.
This will only update methods in ScriptableScratchMorph. To use this with other classes, replace ScriptableScratchMorph with the class name.
Don't forget to include the method title in your code when using in a block, or you may crash something!
Maybe t3 could be replaced with nil? Have a go.
Last edited by TheSuccessor (2011-04-29 08:53:00)
Offline
Let me do it.
Can't seem to get it working.
Last edited by johnnydean1 (2011-04-29 10:32:09)
Offline
What about reading source code?
Offline
LS97 wrote:
What about reading source code?
Just look in the source for the system browser (Tools-Browser -> Browser). That's also where I got the writing code from.
johnnydean1 wrote:
Let me do it.
Can't seem to get it working.
Did it cause an error? If so, please post it.
Last edited by TheSuccessor (2011-04-29 11:46:48)
Offline
I have had 2 errors. They are both to do with a 'run' command.
Offline
johnnydean1 wrote:
I have had 2 errors. They are both to do with a 'run' command.
Can you post them please?
Offline