Discussion:
[Wxsqueak] WxSqueak Constants
Rob Rothwell
2009-01-10 13:28:16 UTC
Permalink
First, a newbie question:

How do you get away with using constants directly in WxSqueak like wxIdAny,
without quotes or an #? I can't figure that one out!

Also, I am just trying to learn how to get around in WxSqueak by creating a
simple tabbed editor. I can't figure out which event lets me know I have
switched tabs (pages) so I can give the focus to the text editor without
having to click in the edit window as well. Any hints? The wxWidgets
documentation indicates a *EVT_NOTEBOOK_PAGE_CHANGED* message, so I was
looking for something like wxEvtNotebookPageChanged, but it doesn't exist.
Just not implemented?

I know these are very basic questions, but there are basic Smalltalk things
I don't know how to figure out.

I keep coming back to this because it is the one UI framework for Squeak I
seem to be able to understand and figure out on my own...

Thanks,

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/wxsqueak/attachments/20090110/66f7dd0b/attachment.htm
Rob Gayvert
2009-01-10 20:19:06 UTC
Permalink
Post by Rob Rothwell
How do you get away with using constants directly in WxSqueak like
wxIdAny, without quotes or an #? I can't figure that one out!
All of the wx classes inherit from WxBase, which has WxConstants as a
pool dictionary. There's a bit of magic here, in that WxConstants is
actually loaded at startup from the VM, so that it gets the correct
values of these constants for the current platform (e.g., some values
are different for Windows vs OS X).
Post by Rob Rothwell
Also, I am just trying to learn how to get around in WxSqueak by
creating a simple tabbed editor. I can't figure out which event lets me
know I have switched tabs (pages) so I can give the focus to the text
editor without having to click in the edit window as well. Any hints?
The wxWidgets documentation indicates a *EVT_NOTEBOOK_PAGE_CHANGED*
message, so I was looking for something like wxEvtNotebookPageChanged,
but it doesn't exist. Just not implemented?
Figuring out which events to use is one of the hardest parts of using
wxWidgets, especially if you're not using a GUI builder. In this case
the documentation references the *macro* EVT_NOTEBOOK_PAGE_CHANGED, but
the actual event is wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED (you have to
keep in mind that the manual is written for C++ programmers).

Take a look at the controls sample, in particular
WxControlsSamplePanel>>setupEvents.
Post by Rob Rothwell
I know these are very basic questions, but there are basic Smalltalk
things I don't know how to figure out.
Sometimes the most basic questions are the hardest, especially when they
reveal weaknesses in the framework ;)
Post by Rob Rothwell
I keep coming back to this because it is the one UI framework for Squeak
I seem to be able to understand and figure out on my own...
Thanks,
Rob
Rob Rothwell
2009-01-10 21:58:47 UTC
Permalink
All of the wx classes inherit from WxBase, which has WxConstants as a pool
dictionary. There's a bit of magic here, in that WxConstants is actually
loaded at startup from the VM, so that it gets the correct values of these
constants for the current platform (e.g., some values are different for
Windows vs OS X).
Ok...so if I want to add my own menu Id's, say, I would use the traditional
method of, say, #fileDoSomethingNew...

Always the magic...!
Post by Rob Rothwell
Also, I am just trying to learn how to get around in WxSqueak by creating
a simple tabbed editor. I can't figure out which event lets me know I have
switched tabs (pages) so I can give the focus to the text editor without
having to click in the edit window as well. Any hints? The wxWidgets
documentation indicates a *EVT_NOTEBOOK_PAGE_CHANGED* message, so I was
looking for something like wxEvtNotebookPageChanged, but it doesn't exist.
Just not implemented?
Figuring out which events to use is one of the hardest parts of using
wxWidgets, especially if you're not using a GUI builder. In this case the
documentation references the *macro* EVT_NOTEBOOK_PAGE_CHANGED, but the
actual event is wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED (you have to keep in
mind that the manual is written for C++ programmers).
Take a look at the controls sample, in particular
WxControlsSamplePanel>>setupEvents.
Late last night (or early this morning), I did find the controls sample, and
tried something like:

panel on: #wxEvtCommandNotebookPageChanged send: [:evt | tc setFocus. tc
setInsertionPoint: 0. evt skip], but still the notebook tab retains the
focus. You're right about searching for the proper events; it's VB6 all
over again!

Sometimes the most basic questions are the hardest, especially when they
reveal weaknesses in the framework ;)
On the "VB6" note, how would you recommend wiring controls to your model? I
was thinking about doing something like Aida does with the concept of
WebElements. You know, create something like a wxCheckBoxElement that does
the event handling for you and wires the value of the check to your domain
model, and then being able to build new elements containing other elements.

Otherwise, it DOES feel very much like standard Windows event driven
programming with your code spread out all over the place...

However, since I have a background with windows controls, understanding the
widgets is easier for me than Morphic widgets, or VW controls, so I think I
could actually wrap my mind around wiring a real model to a view--I just
thought I'd ask if you found something worked better in your experience!

Thank you,

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/wxsqueak/attachments/20090110/ee5a4b91/attachment.htm
Rob Rothwell
2009-01-11 00:37:40 UTC
Permalink
Ok...I see what you have done...sort of...!

You are using "Presenters" and "PluggableWidgets" to do what I asked, I
think.

Take care,

Rob
Post by Rob Rothwell
All of the wx classes inherit from WxBase, which has WxConstants as a pool
dictionary. There's a bit of magic here, in that WxConstants is actually
loaded at startup from the VM, so that it gets the correct values of these
constants for the current platform (e.g., some values are different for
Windows vs OS X).
Ok...so if I want to add my own menu Id's, say, I would use the traditional
method of, say, #fileDoSomethingNew...
Always the magic...!
Post by Rob Rothwell
Also, I am just trying to learn how to get around in WxSqueak by creating
a simple tabbed editor. I can't figure out which event lets me know I have
switched tabs (pages) so I can give the focus to the text editor without
having to click in the edit window as well. Any hints? The wxWidgets
documentation indicates a *EVT_NOTEBOOK_PAGE_CHANGED* message, so I was
looking for something like wxEvtNotebookPageChanged, but it doesn't exist.
Just not implemented?
Figuring out which events to use is one of the hardest parts of using
wxWidgets, especially if you're not using a GUI builder. In this case the
documentation references the *macro* EVT_NOTEBOOK_PAGE_CHANGED, but the
actual event is wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED (you have to keep in
mind that the manual is written for C++ programmers).
Take a look at the controls sample, in particular
WxControlsSamplePanel>>setupEvents.
Late last night (or early this morning), I did find the controls sample,
panel on: #wxEvtCommandNotebookPageChanged send: [:evt | tc setFocus.
tc setInsertionPoint: 0. evt skip], but still the notebook tab retains the
focus. You're right about searching for the proper events; it's VB6 all
over again!
Sometimes the most basic questions are the hardest, especially when they
reveal weaknesses in the framework ;)
On the "VB6" note, how would you recommend wiring controls to your model?
I was thinking about doing something like Aida does with the concept of
WebElements. You know, create something like a wxCheckBoxElement that does
the event handling for you and wires the value of the check to your domain
model, and then being able to build new elements containing other elements.
Otherwise, it DOES feel very much like standard Windows event driven
programming with your code spread out all over the place...
However, since I have a background with windows controls, understanding the
widgets is easier for me than Morphic widgets, or VW controls, so I think I
could actually wrap my mind around wiring a real model to a view--I just
thought I'd ask if you found something worked better in your experience!
Thank you,
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/wxsqueak/attachments/20090110/74f3c6fd/attachment.htm
Loading...