Hi - you will get the most benefit by working through the problem yourself 
which is why folks are hesitant to “do it for you”, as you won’t learn 
meaningfully that way.

Have you tried putting a break point in the code and using the debugger? (You 
can use the code “self halt.” If you can’t figure out breakpoints (but I’m sure 
you can find docs on the debugger).

Then see what the state of things are. Step into code and see what it’s doing. 
You can also evaluate expressions and get results to check things (if you can’t 
figure that out - assign some temp variables).

This is how you will learn how to help yourself, and it will make you more 
productive in the long run.

Hope this helps,

Tim

> On 29 Jul 2020, at 04:44, shawon58 <shawonhoqu...@gmail.com> wrote:
> 
> 
> Hello KMO
> i follow your step one by one and make the form but i want to run :
> 
> connectPresenters
> myButton whenActivatedDo: [LibC system: 'a.bat', myTextField asString].
> 
> That means when i put any value in text field than press click me than that
> value need to send to my bat file as string. so i dont know is that ok or
> not. but if i write:
> 
> myButton whenActivatedDo: [LibC system: 'a.bat 10'].
> 
> than its work perfectly but my concern is to get the value from text field
> not the fixed value.
> SO i think  i am doing in the wrong things. Please help me with this issue.
> 
> Thanks a lot 
> 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
> 


Reply via email to