Hi there,
Well, the first thing that came to my mind was exactly what you have
described. However, after some work, i've realized that for .net it's
not as easy as it seems. Inheriting from a control does not give you all
you want for such a task. For example there are some behaviours of
controls that you don't want in design time, and disabling these
behaviours is tricky, and sometimes impossible. When i came across the
free book (
http://www.apress.com/free/content/Dissecting_A_CSharp_Application.pdf
) by #Develop guys, i've seen the exact complaint in the beginning of
the gui designer chapter!! Believe me, it was a relief to find out that
i'm not the only one :)
The other technique i've mentioned is used in java, and it's not that
that ugly actually. For example eclipse gui designer uses this method to
represent swing and swt controls on the designer, and once you work on
it a little bit you can see that it's not that complicated. If you make
XButton a custom control, than event handling like being clicked in
designer and such stuff is not that hard.
I just wanted to hear your opinions about this, and thanks a lot by the
way, for your kind response.
I'm doing this half for fun, and half for the times i needed a gui
designer for designing gui's for many apps i've developed. I definitely
believe that having a gui designer that can save a designed form in an
intermediate and abstract level (XML for example) is very useful for
many of my projects. XUL and Avalon are initiatives going this way, and
with oppurtunities like AJAX, i believe gui development and binding of
GUI definition to different user interfaces (web, desktop and mobile
clients...) will be much easier in the future. See, i have some other
ideas about alternative ways for RAD, and i think starting out with a
gui designer is a good first step.
Personally i'd really like to join #Develop guys, but i have a
commitment problem :) I mean i'd rather not be involved in any group
effort if i can't hold up to my promises. But again, giving whatever i
can come up with to #Develop would be just fine for me.
Thanks again for your response.
Best Regards
Seref Arikan
J. Merrill wrote:
Do you really mean that your XButton "contains a reference to a good old button instance, and
it uses the image of button to paint itself"? That is, are you really creating a "good
old button (GOB) instance" in your XButton constructor, setting it up to draw somewhere other
than on the visible part of the screen, and hoping to copy the image it draws there onto the real
screen? I don't think you would want to do this (even if you could get it to work well), because
no events would ever occur on the GOB instance, because it's not really on the screen -- so
clicking on, or moving the mouse over, the image you had copied would not generate an event on the
GOB instance. You'd have to do all the work to set up events on your button, just as if the
existing controls didn't exist. (Ugh.)
Your XButton could descend (inherit) from GOB and add any design-time features you want to it. You would
then have all the functionality of GOB plus whatever you need for your designer. That would be the way I'd
think would be easiest, and will give you the least trouble in setting up relationships between different
controls. (For example, suppose you have a label that sometimes holds an error message produced during
validation of [one or more] other controls. If that descends from the standard Label, code in other controls
can see it. If it doesn't pass the [from the C# perspective] "is Control" or "is Label"
or "is ValidationLabel" test, it wouldn't be seen.)
Out of curiosity, why are you trying to do this? If it's an "exercise for the
reader" that's fine; but if you have a great idea for making an improved GUI
designer, you'd be doing the world a favor if you join the #Develop people and implement
whatever wonderful magic you've figured out there -- then a lot more people would get the
benefits. (And you'd have a _lot_ less work to do!)
At 11:27 AM 1/11/2006, Seref Arikan wrote (in part)
This is the third time i'm trying to send this one, and if you have
received it before, i'm really sorry about it. ok, here we go again:)
Ok,
This has been a question i've been dealing for a while. My target is to
build a gui desinger using c#. When it comes to developing a gui
designer, there are 2 basic strategies i can come up with. First one is
to use the built in designer suppport mechanism in .net. This has been
mentioned and used by the guys who wrote sharp develop if i'm not
mistaken. According to this approach, i'll use the functionality
provided by the framework, to create a designer. There are some
documents about this, and maybe even a book (i could not remember its name)
However, another approach can be to create my custom controls, which use
a real control in the background for displaying in design time. To be
more clear, my XButton Control contains a reference to a good old button
instance, and it uses the image of button to paint itself. I do this for
every control i need to use, including the forms, and at the end, i have
another approach. Actually, i can do this in java , and have
experimented with it. Getting an image from a control in java is not a
hard task, but for .net, it appears to me that i will need to deal with
some interop to get image of a control.
My question is, what would you think about these two solutions, and are
there any other practices that you would recommend? I'd really
appreciate your opinions.
Best Regards
Seref Arikan
J. Merrill / Analytical Software Corp
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com