[Pharo-users] Working directory and image directory

2020-07-30 Thread Davide Varvello via Pharo-users
--- Begin Message ---
Hi Guys,
As I already described here:
http://forum.world.st/Fuel-FLSerializer-tests-are-not-working-pharo-8-td5120052.html
there is something weird on Pharo 8 (on Mac) because I'm running an image
that is in the same directory of the Pharo.app but "FileLocator
workingDirectory" give me the root directory.

I expected the same directory where there is Pharo.app
Cheers
Davide



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

--- End Message ---


Re: [Pharo-users] Want to create a text Field using SPEC2 to get Value from User

2020-07-30 Thread Ben Coman
On Wed, 29 Jul 2020 at 23:57, kmo  wrote:
>
> Let's see: 'a.bat 10' works but 'a.bat', myTextField asString does NOT work.
> There's clearly something wrong with 'a.bat', myTextField asString - but
> what? As Tim says, you have to investigate.
>
> Tim has suggested a couple of ways you could investigate. Here's another -
>
> You have my code that writes the stuff typed in to myTextField to the
> Transcript when you click the button. Did you get it working? Did you try it
> out? Are you happy you understood it? The Transcript is not perhaps the best
> way to debug but in this case you have it readily available.
>
> Amend that code so that it writes out 'a.bat', myTextField asString to the
> Transcript. Do you get what you expect? If not, why is that?
>
> When you see what you are getting it should give you a good clue as to what
> is wrong. Keep experimenting with the code until you get precisely what you
> want appearing in the Transcript. Then you can go back and change the code
> to use LibC

This is good advice, and to clarify further...

If this works...
myButton whenActivatedDo: [LibC system: 'a.bat 10'].
and this doesn't...
   myButton whenActivatedDo: [LibC system: 'a.bat', myTextField asString].
and you can't see why, then you likely have an assumption about what
you think is happening, that is blinding you what is actually
happening, which you need to expose :)
i.e. you need to know *exactly* what string is being passed in the
#system: call.
One way to do that is to replace "LibC system:" with
"Transcript:show:" in your code.

cheers -ben.
myButton whenActivatedDo: [ Transcript show: myTextField text]



Re: [Pharo-users] Want to create a text Field using SPEC2 to get Value from User

2020-07-30 Thread shawon58
Hello KMO 
i solve that issue but can you help me one thing. i want to add a label
infront of text field. Can you tell me how to do that, in code where i need
to change ?


Thanks

 


kmo wrote
> This code should give you a clue of how to do what you want. You can file
> it
> in or type it in yourself. You can run it from the playground with the
> command -
> 
> SimpleExample new openWithSpec.
> 
> How it works - You need to subclass SpPresenter. You need to set up an
> instance method called initializePresenters to create a text input and a
> button. You then create aninstance method called connectPresenters to put
> a
> handler on to the button.
> 
> You need a class side method called defaultSpec to layout the button and
> the
> text input
> 
> That's it.
> 
> Note that you have to hit enter to register any change in the text field.
> You will need the transcript open to see the results in this example.
> 
> Hope this helps 
> 
> SpPresenter subclass: #SimpleExample
>   instanceVariableNames: 'myButton myTextField'
>   classVariableNames: ''
>   package: 'KMP-SimpleSpecExample'!
> 
> !SimpleExample methodsFor: 'as yet unclassified' stamp: 'KMP 7/28/2020
> 16:20'!
> initialize 
> super initialize ! !
> 
> 
> !SimpleExample methodsFor: 'initialization' stamp: 'KMP 7/28/2020 16:31'!
> initializePresenters 
> myButton := self newButton .
> myButton label:'Click Me'.
> myTextField := self newTextInput.
> ! !
> 
> !SimpleExample methodsFor: 'initialization' stamp: 'KMP 7/28/2020 16:29'!
> connectPresenters 
> "Put what you want to do when the button is clicked hhere"
>  myButton whenActivatedDo: [ Transcript show: myTextField text].! !
> 
> "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
> 
> SimpleExample class
>   instanceVariableNames: ''!
> 
> !SimpleExample class methodsFor: 'specs' stamp: 'KMP 7/28/2020 16:30'!
> defaultSpec 
> 
> ^ SpBoxLayout newVertical 
>   borderWidth: 10;
>   spacing: 10;
>   add: #myTextField  expand: false;
>   add: #myButton expand: false;
>   yourself! !
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Want to create a text Field using SPEC2 to get Value from User

2020-07-30 Thread kmo
You need to do two things. Firstly, you need to create a label. Secondly, you
need to add it to the layout.

The first bit is easy. You create the label in the initializePresenters
method just like you did the button and the text field. There's a method
that creates a label. If you open a system browser (CTRL+O+B) on SpPresenter
and have  look at the methods you will see which one to use. It's obvious,
really.

To lay out the field and the label the way you want you need to add the
label to the layout in the class method defaultSpec.

However, the existing SpBoxLayout there can only lay out the controls either
vertically or horizontally. So you can have the controls going from top to
bottom or left to right but that's all.

If you want to have the label and the field on one line and the button
underneath you will have to replace the SpBoxLayout with a SpGridLayout.
This lays out things in a grid of columns and rows. 

Then you add the controls like this:

add: #myTextField at: 2@1

This places the control in column 2 of row 1. 

You don't have to define or size the columns - the SpGridLayout does it all
for you.

Hope this helps.



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Editing in Pharo Debugger

2020-07-30 Thread horrido
I was wondering...

Is there an easy way to update my Pharo 9.0 Development version with updated
versions? I presume Pharo 9.0 is constantly changing.

And how frequently are there updated versions?

Thanks.



horrido wrote
> The latest 9.0 64-bit development version that I downloaded earlier this
> week.
> 
> 
> 
> tbrunz wrote
>> For which version, Richard?
>> 
>> I get the "orange triangle" in Pharo 8.
>> 
>> -t
>> 
>> 
>> 
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Editing in Pharo Debugger

2020-07-30 Thread tbrunz
If you're using Pharo Launcher, you can update your VM from the "VMs" dialog.

And from PL you can download new images; I think it fetches the latest,
updated image version when you do.

-t



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html