Example program for Blox

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Example program for Blox

ZuLuuuuuu
Hello,

I tried to do myself a GUI application via Blox but couldn't achieve much. Is
there any example program written for Blox? I tried looking at the code of
Tetris and the code of class browser but dind't get much. A program which
consists of a simple window and button (doing something when pressed) would be
very helpful...



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Canol Gökel
Reply | Threaded
Open this post in threaded view
|

Re: Example program for Blox

Paolo Bonzini-2
Canol Gokel wrote:
> Hello,
>
> I tried to do myself a GUI application via Blox but couldn't achieve much. Is
> there any example program written for Blox? I tried looking at the code of
> Tetris and the code of class browser but dind't get much. A program which
> consists of a simple window and button (doing something when pressed) would be
> very helpful...

You can look at packages/blox/tests/test.st

It contains some functional tests to be used as

   BLOX.Gui test: #testName

where testName is one of

     callbackTest [
     canvasTest [
     dropdownTest [
     vContainerTest [
     hContainerTest [
     editTest [
     eventTest [
     formTest [
     formattingTest [
     textEventsTest [
     imageTest [
     labelTest [
     listboxTest [
     textTest [
     fileDialogTest [
     colorDialogTest [
     menuTest [
     popupMenuTest [
     iconTest [
     progressTest [
     colorButtonTest [
     balloonTest [

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Example program for Blox

ZuLuuuuuu
Paolo Bonzini <bonzini <at> gnu.org> writes:

>
>
> You can look at packages/blox/tests/test.st
>
> It contains some functional tests to be used as
>
> Paolo
>


I looked at that but couldn't solve how to write the main loop which waits for
events to occur.

There is a loop like this in test.st:

[win exists] whileTrue: [(Delay forMilliseconds: 50) wait.

But it didn't behaved well while I was trying to create a simple window. Is
there a more elegant way like:

Tk().mainloop()

in Python?

It also gives an error like:

test.st:3: key Gui not found

while trying to run. I didn't try it on Linux though.

A simple script which creates a window and a button in it which closes the
window when pressed at the button would be much appreciated :) Then I would be
able to find out most other things by investigating the class browser.



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Canol Gökel
Reply | Threaded
Open this post in threaded view
|

Re: Re: Example program for Blox

Paolo Bonzini-2
Canol Gokel wrote:

> Paolo Bonzini <bonzini <at> gnu.org> writes:
>
>>
>> You can look at packages/blox/tests/test.st
>>
>> It contains some functional tests to be used as
>>
>> Paolo
>>
>
>
> I looked at that but couldn't solve how to write the main loop which waits for
> events to occur.
>
> There is a loop like this in test.st:
>
> [win exists] whileTrue: [(Delay forMilliseconds: 50) wait.

No, that loop is just in the progress bar test, to modify the progress
bar every 50 ms.  The event loop is

         BLOX.Blox dispatchEvents: win

(see Gui class>>#test:)

> It also gives an error like:
>
> test.st:3: key Gui not found

Just load it with

        PackageLoader fileInPackage: 'Blox'

and go around in the class browser.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Example program for Blox

ZuLuuuuuu
Paolo Bonzini <bonzini <at> gnu.org> writes:

> The event loop is
>
>          BLOX.Blox dispatchEvents: win
>
> (see Gui class>>#test:)
>
> Paolo
>

Oh, ok thanks...




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Canol Gökel