sparks wrote:
Hey, two questions:
can Scratch create a FOLDER on your computer using smalltalk and is there a way to create a costume with a chosen text, font, size and colour?
Thanks!
Can Scratch do it?
Do you mean Squeak?
Offline
ProgrammingFreak wrote:
sparks wrote:
Hey, two questions:
can Scratch create a FOLDER on your computer using smalltalk and is there a way to create a costume with a chosen text, font, size and colour?
Thanks!Can Scratch do it?
Do you mean Squeak?
No. I mean smalltalk. An edited version of Scratch (Panther really) should be able to do these things with smalltalk. Squeak is the VM.
Offline
sparks wrote:
ProgrammingFreak wrote:
sparks wrote:
Hey, two questions:
can Scratch create a FOLDER on your computer using smalltalk and is there a way to create a costume with a chosen text, font, size and colour?
Thanks!Can Scratch do it?
Do you mean Squeak?
No. I mean smalltalk. An edited version of Scratch (Panther really) should be able to do these things with smalltalk. Squeak is the VM.
I know. But you said 'Scratch'. OH never mind.
Yes. It would be. I was actually reading about this. Lemme find it....
Offline
It can create a new folder. I'll look for the code.
Offline
aStream := aFilenameString asFilename writeStream
That's the setup for it.
Offline
Look at this:
UIDialogs-FilePicker-private-newDirectiory
newDirectory
| t1 |
t1 _ StringDialog askWithCancel: 'New folder name:'.
t1 = '' ifTrue: [^ self].
[self currentDirectory createDirectory: t1]
ifError: [:t2 :t3 | ^ DialogBoxMorph warn: 'Could not create folder.'].
self currentDirectory: self currentDirectory
Offline
johnnydean1 wrote:
Look at this:
UIDialogs-FilePicker-private-newDirectiory
newDirectory
| t1 |
t1 _ StringDialog askWithCancel: 'New folder name:'.
t1 = '' ifTrue: [^ self].
[self currentDirectory createDirectory: t1]
ifError: [:t2 :t3 | ^ DialogBoxMorph warn: 'Could not create folder.'].
self currentDirectory: self currentDirectory
Why not have it as a CustomDialog?
Offline
I dunno, but thats what scratch uses!
Offline
johnnydean1 wrote:
I dunno, but thats what scratch uses!
Oh, so scratch can make files?
Offline
ProgrammingFreak wrote:
johnnydean1 wrote:
I dunno, but thats what scratch uses!
Oh, so scratch can make files?
Scratch can make files. Remember the little scratchthumb files that appear in folders when you view it through Scratch?
Offline
sparks wrote:
ProgrammingFreak wrote:
johnnydean1 wrote:
I dunno, but thats what scratch uses!
Oh, so scratch can make files?
Scratch can make files. Remember the little scratchthumb files that appear in folders when you view it through Scratch?
Ah, yes.
Offline
johnnydean1 wrote:
Look at this:
UIDialogs-FilePicker-private-newDirectiory
newDirectory
| t1 |
t1 _ StringDialog askWithCancel: 'New folder name:'.
t1 = '' ifTrue: [^ self].
[self currentDirectory createDirectory: t1]
ifError: [:t2 :t3 | ^ DialogBoxMorph warn: 'Could not create folder.'].
self currentDirectory: self currentDirectory
Thats your folder problem sorted then!!!
Offline
johnnydean1 wrote:
johnnydean1 wrote:
Look at this:
UIDialogs-FilePicker-private-newDirectiory
newDirectory
| t1 |
t1 _ StringDialog askWithCancel: 'New folder name:'.
t1 = '' ifTrue: [^ self].
[self currentDirectory createDirectory: t1]
ifError: [:t2 :t3 | ^ DialogBoxMorph warn: 'Could not create folder.'].
self currentDirectory: self currentDirectoryThats your folder problem sorted then!!!
It looks good - didn't work as a custom block though...
Offline
sparks wrote:
johnnydean1 wrote:
johnnydean1 wrote:
Look at this:
UIDialogs-FilePicker-private-newDirectiory
newDirectory
| t1 |
t1 _ StringDialog askWithCancel: 'New folder name:'.
t1 = '' ifTrue: [^ self].
[self currentDirectory createDirectory: t1]
ifError: [:t2 :t3 | ^ DialogBoxMorph warn: 'Could not create folder.'].
self currentDirectory: self currentDirectoryThats your folder problem sorted then!!!
It looks good - didn't work as a custom block though...
Read how it works. The currentDirectory needs setting.
Offline
Ill let you discuss this. I don't get how it works.
Offline
bbbeb wrote:
its the programs current directory.
![]()
hm... then how come the block won't currently work? It gives me the syntax error:
| t1 |
t1 _ 'test'.
UIDialogs-FilePicker-private-newDirectiory
newDirectory
| t1|
t1 Nothing more expected ->_ StringDialog askWithCancel: 'New folder name:'.
t1 = '' ifTrue: [^ self].
[self currentDirectory createDirectory: t1]
ifError: [:t2 :t3 | ^ DialogBoxMorph warn: 'Could not create folder.'].
self currentDirectory: self currentDirectoryLast edited by sparks (2011-04-20 16:35:53)
Offline
This is the problem?
t1 _ StringDialog askWithCancel: 'New folder name:'.
1. Destroy the
t1_ 'test'.
You dont need that.
2. You declared t1 twice,
that may cause syntax problems.
Offline
bbbeb wrote:
This is the problem?
Code:
t1 _ StringDialog askWithCancel: 'New folder name:'.1. Destroy the
t1_ 'test'.
You dont need that.
2. You declared t1 twice,
that may cause syntax problems.
t1 is only declared once and never set to 'test' if you look at the actual block code:
UIDialogs-FilePicker-private-newDirectiory
newDirectory
| t1|
t1 _ StringDialog askWithCancel: 'New folder name:'.
t1 = '' ifTrue: [^ self].
[self currentDirectory createDirectory: t1]
ifError: [:t2 :t3 | ^ DialogBoxMorph warn: 'Could not create folder.'].
self currentDirectory: self currentDirectoryOffline
It is not the current directory of the Scratch project. When you are in a file browser window, the directory your looking at is the currentDirectory.
Offline
johnnydean1 wrote:
It is not the current directory of the Scratch project. When you are in a file browser window, the directory your looking at is the currentDirectory.
ooohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
then somethings wrong with my logic atm
*cough*tryingtolearnC++issohard*cough*
Offline
bbbeb wrote:
johnnydean1 wrote:
It is not the current directory of the Scratch project. When you are in a file browser window, the directory your looking at is the currentDirectory.
ooohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
then somethings wrong with my logic atm
*cough*tryingtolearnC++issohard*cough*
C++ isn't thats hard.
Offline
johnnydean1 wrote:
bbbeb wrote:
johnnydean1 wrote:
It is not the current directory of the Scratch project. When you are in a file browser window, the directory your looking at is the currentDirectory.
ooohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
then somethings wrong with my logic atm
*cough*tryingtolearnC++issohard*cough*C++ isn't thats hard.
Win32 C++ is a real pain!
It's all illogical, you're better of learning the .NET version if you want to keep your sanity.
Offline