Yes You can Subclass Window!!!!

Because you can not subclass a Window with controls already on it, people mistakenly think that you can’t subclass Window at all… and that is untrue.

Try it.

Add a class (myWindowSubclass) and set it’s super to Window…

How to use it… Create a window normally and add controls… THEN set that Windows Super To myWindowSubclass.

You can add events, and write code that iterates through the controls on the Window and use IsA to send a message to that control or set a property … or whatever might be needed…

I still remember when they introduced that in the REALbasic days (I think). Super useful, and super non-obvious.

I’ve used this for a long time with all my (database) apps !
I have a ListWindow and PageWindow classes that handle databases in a list style, or editing style.
then each table that needs a list or page view has its own window subclassed from one of the above.
saves a lot of programming time.

I was really excited at first, then I realized that almost nothing useful works with RS2012r2.1 (which I think is the latest IDE worth using)

do you put the code for event etc on the myWindowSubclass or the new window with controls?

common code in the myWindowSubclass, and specific to the instance in the new window.

Way off topic, but I have to admit that for new projects, I do all of my layout in 12r2.1 and then bring that project into 16r3, save again and bring forward into the latest for final work. A PITA, but more functional than dealing with the performance issues in the latest IDEs.

Code that are specific to the uniqueness of an instance should go on the instance… code that applies to all instances on subclass.

BTW it possible to do a sort of UI subclassing… though it’s probably not the best thing to do… (I did it early on)

If I wanted code that integrates with specific controls for a specific layout that would be on EVERY instance of the window (or ContainerControl) subclass , I would create properties representing the controls that will be here when I create the UI, and assign teh controls to the corresponding property in the open event…

That and using AddHandler means you can put a MUCH of UI logic/code in the Window Subclass… But it’s messy and I’m not sure if it is worth doing. It makes modifying things more work and would be needed very seldom.

  • Karen

Karen,
you can do clean things using class interfaces. all items in the window subclass must belong to the class interface
then you subclass each control you want ( textfield, checkbox, etc) to be a member of the class interface, and write the corresponding methods to read and store databases.
common code goes to the window subclass and controls subclasses, and specific code to the instances in each window.
I don’t use any addhandler in theses methods.

What is it in 2012R2.1 that is missing or broken in 2017R3? I used to agree with your statement until I worked with 2017R3 long enough to get used to it.

I am like you I think it is a matter of getting used to a new interface. it can take some time.

For me, it’s the speed with which I can accomplish project layout. 12r2.1 is by far the most responsive of all of the IDE’s.

CMD-M, CMD-P, CMD-E, CMD-C - no need to select a certain area of the Navigator. I’m a keyboard user and only hit the mouse when I absolutely must. Under later IDE’s, you can hammer CMD-P all you want, and unless you’re on the Properties section of the Navigator, the probability is that you will not create a new Property.

on the mac it is cmd-option-P and it’s working from everywhere you are with the cursor.
but I agree the TAB not always lead you where you should go in a logic order.
new method - type the name - tab - you are in the parameter - tab you are in the code instead of the return value.

[quote=418238:@Jean-Yves Pochez]but I agree the TAB not always lead you where you should go in a logic order.
new method - type the name - tab - you are in the parameter - tab you are in the code instead of the return value.[/quote]

And that should be so easy to fix …

That’s what I meant. - or CTRL-SHIFT-P/M/E/C on Linux and Windows.

I find that if I successfully create a Method using CMD-OPT-M, when I hit tab after entering the method name I’m taken to the Editor instead of the Parameters field.

Regardless, these work as expected in 12r2.1.

well I don’t know because I’m struggling with a similar tab order problem in my apps and I’ve not found so far !

There is a bug where tab orders are constantly changing when savimg the project (any type)

Do you have a feedback case number for this show stopper?

feedback://showreport?report_id=54377

That case is about adding / removing TabStop, I thought you meant it was changing the order which would be an absolute show stopper.