If this is what I have to do, I don’t see any advantage of creating a
separate PtMyWindows class compared to just using PtWindows in my
case, if I have to specify default values from PhAB. What I want to
accomplish from this experiment was to create my own PtMyWindow class
with predefined default values set within the Class code and not from
PhAB or Momentics IDE .wgtw file. Then once I create my application
using this PtMyWindow class without changing the default values, I
would like my application to inherit new default values when I
recompile my PtMyWindow class with different sets of default values.
The short answer is that PhAB was not designed to support anything like
that. Any resource that PhAB knows about must have its default value
specified in the palette file. If you cheat and give PhAB a value
that’s not really the default, that may cause PhAB to misbehave. Of
course, depending on how much you know about how PhAB works, you may be
able to guess how badly PhAB will misbehave in certain cases and how to
work around it; but in general, that’s unsupported territory.
For example, today we might have decided to have all our window widget
with fill color blue, but a year from now we might change all our
window widget to have green. If we have just used the standard PhAB
building approach we have to manually change all the window widget in
our application to make this change. But if we can just change one
master copy (PtMyWindow) and have all the window widget changed, this
what I am looking for here. I was able to do this with other widget
classes such as button, and label by creating my own Ptmybutton and
ptmylabel, and as soon as I make change to those classes, I don’t
even have to recompile my application to have those changes applied
because ptmybutton.so file is linked at runtime and it’s default
values are being set at runtime by the default function in the code.
The difference between your MyPtButton and your MyPtWindow is that PhAB
actually attempts to load your library and use your real MyPtButton, but
always uses a PtContainer to display your MyPtWindow. A real MyPtButton
will display its real default colour if it hasn’t been overriden in
PhAB; a fake PtMyWindow will display the colour that your palette file
tells PhAB is the default. Since PhAB never creates a real MyPtWindow,
it has no way to find out what its defaults really are.
Is this possible with PtWindow? I know I can do this with widget
database but I would like to create inherited widget classes so that
I can use PhAB to design my GUI and have more flexibility.
You could use a template to set up a MyPtWindow that has its fill colour
set to its default, as defined by the palette file. It won’t update
itself automatically inside PhAB when you change the default in your
library; but if you also change it in your palette file, I think PhAB
should display it accordingly. As far as I can tell, that’s the closest
to what you want that PhAB “almost officially” supports.