Re: Win32Lib vs. Ease of Use
- Posted by "Cuny, David" <David.Cuny at DSS.CA.GOV> Sep 21, 1999
- 361 views
Lewis Townsend wrote: > Okay, I guess the hardest part about Win32Lib > is that there is so much of it. In VEL there > is just a few commands to master that do a > lot of stuff: Point taken. In Llama, I added an interface that looked like this: setMy( control, attribute, value ) getMy( control, attribute ) But I abandoned it, because it seemed that writing: setMy( checkbox, Active, True ) state = getMy( checkBox, Checked ) But it didn't really seem to add that much, since you needed to know the names of the attributes anyway. In Win32Lib, I just prefix 'get' and 'set' to the attribute when naming the functions: setActive( checkbox, True ) state = getCheck( checkbox ) I'm sure better documentation would help a lot. Someone (I've *very* bad with names) had written a nice Win32Lib tutorial and placed it on the internet somewhere. > Also, I've never understood fully the concept of > on_paint () is that the same thing as On_Change or > On_Load? Only in the sense that they are both event traps. The onPaint routine is responsible for rendering your window. Windows doesn't keep a copy of the image you render on the window. For example, imagine that you had written a simple scribble program. If you resized the window, the window would be erased, and Windows would tell your application that it needed to redraw the entire window. [Well, technically it's possible to ask Windows to keep a copy of your window's image, but it eats up a ton of memory. Unless you are doing graphics, you don't need to have that kind of overhead.] Events that cause an onPaint to trigger include: - another window covers your windows, and then moves away - your window is resized - your window is hidden, and then displayed (onOpen triggers this) The parameters passed to the onPaint routine tell your program what part of the window needs to be updated. Most applications ignore these values, and simply update the entire window. When I first wrote Win32Lib, I tried to hide all these details, but this turned out to be a bad plan. Again, better documentation would really help. With the addition of double buffering, writing graphic-intensive applications is a lot easier than it used to be. > Why does the Create () need the position and > size of the control? ... I figured that the attributes in create() are pretty much the minimum that controls shared. I agree that you could use default values for the size, but you'd almost always want to change it. You wouldn't want to use the default values for position, or all the controls would overlay each other. I suppose the create() routine could be made smart enough to auto-position new controls, but in this case I think dumber is better - you are invariably going to change the values. Most of these issues go away if you use the IDE. > I'd be glad to use Win32Lib instead if I > can figgure it out. I think you'll find Win32Lib a whole lot easier to use once the IDE is complete. I guess I have a lot of documentation to rewrite as well. -- David Cuny