C++ - Visual Win. Components
This may sound a bit stupid but in the Computing course I''m studying we have recently being learning Delphi, my first windows programming experience.
For those who are unfamiliar you are given a form to which you place components.
I know Visual Basic is similar to this but I was wondering if there is an implementation of this in c++ such as in the borland or microsoft compilers. Are programs created in the same way, using components and are they just a list u practically click-drop onto the form or how is it done?
What about me? What about Raven?
You can use Borland C++ Builder to just about the same effect as with Delphi - the IDE is very similar and the VCL is sitting there too. In general, though:
C++ people like doing things the hard way because nobody has slapped them and told them to grow up.
Most interfaces are designed in Win32 or MFC. These are very low level (and MFC is truly a messed-up design). If you start up Visual C++ then you''ve see there''s a resource editor. What happens is that you design (with much difficulty) your basic interface in the resource view. This generates a resource script with a .RC extension, which is compiled by a resource compiler and is linked your exe.
If you''re creating controls in Win32 API then you basically have lots of code dealing with CreateWindow(Ex) to create ''windows'' and then deal with messages. Whenever Windows has something to tell you it puts a message on the queue. You can check the queue and see what message it is. If it''s something you''re interested in then you route it along to the correct control. If not, you call DefWindowProc to take care of it.
If you''re doing it with MFC then a wizard generates a heap load of code underneath that gives you a basic doc/view model program. This has basic features such as a main menu, tool bar, status bar, and so on plus one or two nice things (new docs and stuff).
The idea is that you have documents, which represent the data in your application. A document can have many views (if you think about Word, for example, there''s "Normal", "Web Layout", and so on). The view gets called when it has to update and it retrieves the information via the document.
Once you get beyond basic tasks MFC starts to piss you off. It''s really poorly designed (the graphics encapsulation is a joke) and doesn''t integrate very well with the resource viewer (for VC++ 6 anyway). It''s a *very thin* layer above win32 and seems... quite pointless, really, compared to what could have been achieved. You find yourself churning through slow-loading help files to find out basic information ("how do I set the background colour of a dialogue?" [the answer to which, obviously, is to assign a message handler to catch the WM_INITDIALOG message via class wizard and override its default brush, IIRC [it''s been a while so that may be slightly off]. Hmm, why didn''t I guess that?).
Don''t expect anything like the productivity of the VCL if you''re not allowed to use the VCL. The alternatives are disgusting.
Oh, and before the knee-jerking starts, take a look at this and see what the interface to VC++ 6 can been made to look like if the creators aren''t lazy.
Use the VCL if you can. There are some widget toolkits like Qt and so on, and I hear that WinForms is close to useable (but that''s just fourth-hand gossip, someone will have to confirm or deny that assertion). You can also use WTL (a cleaner, but not as well documented, thingamajig like MFC).
I haven''t used VC++ .NET yet (and don''t have much inclination to, either). I hear it''s a bit better.
You want to know the reason why lots of bugs exist in software? It''s because the industry standard software makes programming a complete bitch.
C++ people like doing things the hard way because nobody has slapped them and told them to grow up.
Most interfaces are designed in Win32 or MFC. These are very low level (and MFC is truly a messed-up design). If you start up Visual C++ then you''ve see there''s a resource editor. What happens is that you design (with much difficulty) your basic interface in the resource view. This generates a resource script with a .RC extension, which is compiled by a resource compiler and is linked your exe.
If you''re creating controls in Win32 API then you basically have lots of code dealing with CreateWindow(Ex) to create ''windows'' and then deal with messages. Whenever Windows has something to tell you it puts a message on the queue. You can check the queue and see what message it is. If it''s something you''re interested in then you route it along to the correct control. If not, you call DefWindowProc to take care of it.
If you''re doing it with MFC then a wizard generates a heap load of code underneath that gives you a basic doc/view model program. This has basic features such as a main menu, tool bar, status bar, and so on plus one or two nice things (new docs and stuff).
The idea is that you have documents, which represent the data in your application. A document can have many views (if you think about Word, for example, there''s "Normal", "Web Layout", and so on). The view gets called when it has to update and it retrieves the information via the document.
Once you get beyond basic tasks MFC starts to piss you off. It''s really poorly designed (the graphics encapsulation is a joke) and doesn''t integrate very well with the resource viewer (for VC++ 6 anyway). It''s a *very thin* layer above win32 and seems... quite pointless, really, compared to what could have been achieved. You find yourself churning through slow-loading help files to find out basic information ("how do I set the background colour of a dialogue?" [the answer to which, obviously, is to assign a message handler to catch the WM_INITDIALOG message via class wizard and override its default brush, IIRC [it''s been a while so that may be slightly off]. Hmm, why didn''t I guess that?).
Don''t expect anything like the productivity of the VCL if you''re not allowed to use the VCL. The alternatives are disgusting.
Oh, and before the knee-jerking starts, take a look at this and see what the interface to VC++ 6 can been made to look like if the creators aren''t lazy.
Use the VCL if you can. There are some widget toolkits like Qt and so on, and I hear that WinForms is close to useable (but that''s just fourth-hand gossip, someone will have to confirm or deny that assertion). You can also use WTL (a cleaner, but not as well documented, thingamajig like MFC).
I haven''t used VC++ .NET yet (and don''t have much inclination to, either). I hear it''s a bit better.
You want to know the reason why lots of bugs exist in software? It''s because the industry standard software makes programming a complete bitch.
quote: Original post by sanguineraven
I know Visual Basic is similar to this but I was wondering if there is an implementation of this in c++ such as in the borland or microsoft compilers.
VCL is usable from Borland C++, and MSVC has its resource editor. You''ll still need to write significant amounts of code to control how the visible widgets behave and interact with the user and each other.
Other toolkits also provide visual design tools, like Trolltech''s Qt.
quote:
Are programs created in the same way, using components and are they just a list u practically click-drop onto the form or how is it done?
Not in C++. Even the drag-and-drop components you see (and there are companies whose sole business is to provide such components) were at some level written as basic code. In essence, you (the programmer) write instructions in the language of your choice (modern languages are fairly high-level, meaning that they are close to a human-comprehensible language - generally English) and the instructions are translated to a machine-executable format. The machine then carries out those instructions in sequential fashion (gross oversimplification, but you''ll learn the details later).
The question of how programs are created is a fairly atomic/existential one, and even people who''ve been programming for years sometimes don''t fully understand the process. Just stick with the class and ask questions as you progress here. We''ll be here to help you.
If you think the Deplhi is great, then Borlands C++ Builder is the way to go... It''s like a C++ port of Deplhi (I seem to recall that some of TObject actualy is written in Object Pascal)...
On the whole VCL vs. MFC.:
VCL is an angel to work with, while MFC is a bitch..
This doesn''t mean you shouldn''t use MFC, using it, while you might not have much hair left when you''re done, will give you more insight in what''s happening...
On the whole VCL vs. MFC.:
VCL is an angel to work with, while MFC is a bitch..
This doesn''t mean you shouldn''t use MFC, using it, while you might not have much hair left when you''re done, will give you more insight in what''s happening...
Don't Temp Fate..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement