|
From: Alexander S.K. <al...@be...> - 2012-12-13 09:47:19
|
Hi All, for a long time I didn't follow the HwGUI development. For my projects I still use an old version, which is about 4 -5 years old. Sometimes, quite rarely, I did necessary changes and uploaded them here. I didn't use the renewed HwGUI from the SF repository because of a big number of changes, for which I hadn't time and energy to review and to check. From time to time I reviewed the new code partially and returned to my old version because I found there many things, which I don't like. Recently I was asked to review the Designer, because it has serious problems. I've build it with a latest HwGUI code and Harbour 3.2 and really found some: 1) incorrect appearance of non-English characters in some places - this resolves very easy by setting appropriate codepage; 2) object inspector - the selected items remains coloured as selected al the time - I don't know why yet, probably this goes from HBrowse; 3) when I try to open my report forms, the designer simply hangs. I plan to investigate this problems deeper, but before I need to deal with the current HwGUI code. As I wrote above, there are things, which I don't like and which prevent me to upgrade to the newest version. There is a lot of additions, I believe that they are useful and really makes HwGUI better. The problem is with structure. From the beginning I tried to make HwGUI compact and fast. My code wasn't ideal ( now it is a bit better :), and I hope it will better in future - we all are learning till the end of the life ) and there was fragments which I don't like. But now, from the point of a class structure, the things became even worse. I believe, that classes, especially basic classes, which have many objects, should have minimum of variables and methods - only that, which are really necessary. When HCustomWindow has some redundant variables and methods, the HControl, which inherits from it, adds new redundant, the final, for example, most frequently encountered HStatic has a number of redundant stuff. We have a lot of HStatic, HEdit, etc. objects in a form, each of them contains a lot of rubbish, which makes their response time bigger, though they never use it. Why the response time become bigger ? Each control gets a lot of Windows messages, each message is handled in HwGUI code to find appropriate method and execute it. The more methods and vars has the object, the more time is needed to find necessary one. To be more concrete, I consider the following methods of HCustomWindow as redundant: ResetScrollbars(), SetupScrollbars(), RedefineScrollbars() - because they don't needed for most controls, which inherits from HCustomWindow; GetParentForm() - from my point, it is better to write as a function; Hcontrol: FontBold(), FontItalic(), FontUnderline() - I don't see any reson why they should be separate methods. These are only examples, just to clarify my point. There is more stuff which, in my opinion, should be cleared. The second important thing is adding of new features to controls. Look at HBrowse or HEdit - they became so big that it is very difficult to review and understand their work. I believe that most of these new features are useful, but why we put them into the same class ? We absolutely forget about such thing as Inheritance ( the only good exception is the HButtonEx by Luiz - but, IMO, it should be placed in separate file ). I prefer to have simple control classes with basic features, which are demanded in most cases and inherited from them, maybe multiply, "ex" classes - for to keep basic set clean, fast and readable. So, I suggest to rewrite some parts of HwGUI in accordance with these thoughts and I'd like to hear your opinions. Regards, Alexander. P.S. Uff... I hate to write such a long texts, especially on English :) |