IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: I'm not sure I see where you're going...
Make your event handlers call a single function that performs the common functionality. You still have to wire up the event for each copied control, and Delphi's behavior might help there, but how often do you call the exact same code from multiple controls of the same type (there are other mechanisims for toolbar/menu duality)? You'll at least want to pass in different parameters or pull in information from a different set of other controls. Where do you put that code?

I guess what you and jbrabeck describe would save one extra copy/paste per copied control, but at the cost of having to erase that code for every control where you just wanted to duplicate the control's properties (ie: a row of buttons with the same size/color/etc).

Also, I didn't check earler, but in Access if you put an expression (ie: "=DoStuff" where DoStuff is a Sub containing your common code), in an Control's event property and copy that control, the text in the event property will copy much like Delphi's behavior.

--
Chris Altmann
New It's actually quite useful
at least for those of us who do I/O screens: you have a big bunch of buttons to control outputs. The button event should do the exact same thing (turn on an output on the motion controller / PLC / whatever); the only thing that changes is the output bit number.

VB6 Control Arrays work quite nicely for this, but the BCB/Delphi VCL wire many controls to one event handler approach also works well.

The even better approach, which I currently use in Tkinter, is to create all the controls from a mini-database (MetaKit) so adding another output or input is simply a matter of adding another line to the database. That's much better than futzing around with VB GUI screen designer. Still, all the Tkinter output buttons use a common command handler.

Tony
New You can do that in VB...
...that is, create and destroy buttons/textboxes/whatever on the fly.

At least in VB6 you can. Dunno about earlier versions.
Tired of lying in the sunshine staying home to watch the rain.
You are young and life is long and there is time to kill today.
And then one day you find ten years have got behind you.
No one told you when to run, you missed the starting gun.
New Yes, you can, but....
very few people do. And, the support isn't as good as in systems designed for this (Tk, wxWindows, Swing, etc). For example, you don't have good layout managers in VB6.

That's one reason why it's good to learn different languages. After learning Python & Tkinter (plus a little wxPython), when I have to program in VB.nyet (like it looks like I'll be doing soon for a project), I will be be programming differently than I would have a couple of years ago.

Tk has pretty decent layout managers; I can get the layout I want without too much effort. wxWindows seems a little more primitive (but does have a lot of other advantages over Tk). I haven't used Java's Swing. For VB.nyet, I'll probably write my own; MSDN actually has an article on doing it.

Another technique I'll probably use is using a scripting language for flexibility. You can still do this in .nyet (or use class loader), but MS doesn't emphasize it and so most people never think about it....unless you have a scripting background.

Tony
New Quite aware of that situation.
I've done GUI app development (in an educational context only) in Java via Swing, VB, VC++, and VC#. Of all of the methods for layout, Swing freaked me out having such a different way of handling controls. I'm so used to the idea of fixed pixel points that having something like that kinda overwhelms me. The .Nyet interface has some limited Swing-like mapping options, but not many that I've seen so far.

Probably should give some of those others a shot one of these days.
Tired of lying in the sunshine staying home to watch the rain.
You are young and life is long and there is time to kill today.
And then one day you find ten years have got behind you.
No one told you when to run, you missed the starting gun.
New It's worth checking out
The idea also works very nicely for program configuration dialogs. I use Metakit to store the info (and have the Python class automatically create the class variables from the database).

I'm pretty sure there are open source projects out there with a similar approach, but using XML -- basically creating a UI specified by an XML file.

I've heard that some of the Swing layout managers are hard to grasp. You might want to look at John Grayson's Python and Tkinter Programming book; he does some very interesting things with Tkinter.

Tony
     VB.Net, C# and Delphi are the same way - (altmann) - (7)
         I'm not sure I see where you're going... - (jb4) - (6)
             Re: I'm not sure I see where you're going... - (altmann) - (5)
                 It's actually quite useful - (tonytib) - (4)
                     You can do that in VB... - (inthane-chan) - (3)
                         Yes, you can, but.... - (tonytib) - (2)
                             Quite aware of that situation. - (inthane-chan) - (1)
                                 It's worth checking out - (tonytib)

Without passion, there is only suckage.
90 ms