Recently I recently read the report of Borland C Builderx, found that this version is used by wxwindows as Framework. Surprisingly, because I used wxwindows before one year ago. However, at the time, there were still few domestic reports recently related to it. WXWindows is a C extension library. It is an OpenSource project and supports multiple platforms. So, you can get the version and source code of each platform from OpenSource's website. I www.wxwindows.org for WXWindows, I have never seen their aromatics in the past year - the website is unable to access. But despite this, it does not affect us to get it. This loss of the power of OpenSource. WXWindows is most attracting me that it is its simple code - a few simple code, derived with your heart. A window was born. An effect of nearly 100 rows with API. Use wxWindows to solve the problem. I think this may be one of the reasons why Borland chooses it. WXWindows is packaged into classes for a variety of common controls and cumbersome functions. You can use it when you use a line of code. Like
WXButton * p_b = new wxbutton (frame, -1, "button");
That is to draw a button written with Button in the Frame window. Subsequent access as long as used
P_B -> // The function to be called
You can operate the button. I want to use the API to be so convenient to use the API. In fact, behind, wxwindows has made many work silently. Although you can take over to these work in WXWindows. However, sometimes it is not necessary to do it. Of course, if you are dissatisfied with WXWindows control, you can use WXWindows to send your own controls. For example, you are dissatisfied with the main window - there is only one dark gray. You can generate your own main window, the method is as follows:
Class myframe: public wxframe {public: myframe (int width);}; myframe :: myframe (int width, int tent): wxframe * null, wxpoint (0, 0), wxSIze (width, Height)) {// You are adding control added by MyFrame, etc. }
From the above code, you can see. WXWINDOWS flexible class management. Another reason why my love is WXWindows is its compatible and sound non-window classes with the C standard library. For example, in wxwindows I like wxString, it is one of the most sound String classes I have seen. It can not only be compatible with WX or compatible with C standards. In C , wxString is more like a flexible CHAR column. You can use it like char. There is no need to consider prior allocation of memory. Moreover, in some respects, it is more powerful than Char. Of course, the support for multi-platform is also the reason I like it. WXWindows has multiple platforms. I am using MSW. Of course, there are many platforms such as Mac X11 GTK MGL. If you want your code to use on other platforms. Then you will modify the included statement when you compile. It is possible to change the parameters of the platform. For code, you can use it without modifying the code directly without using the function under a particular platform. Of course, wxWindows is not just support for individual operating systems. Since it is OpenSource. So, usually, other non-C languages will also use it. For example, WXPython is WXWindows to Python's version. WXPERL is the version of Perl. WXWindows in these different languages, strive to keep its original programming style and ideas, and they have done it. So, you will wxwindows will be equal to WXPYTHON, WXPERL. Speaking here, I want to say some external words. I also use Python WXPython to do some desktop small toys, not only, when I use wxwindows development interface, WXPYTHON will first write the code of the interface in advance. Then, after it is ok, the re-mechanical enrollment is in my C code. Since Python is an explanatory language, it is less compiled, and the development cycle of connection is compared to C . It is possible to run the code directly. So, save a lot of development time. This is not a good way to reduce the development cycle and accelerate the development speed. Let's take a look at how wxPython and WXWindows are all the same as the same functionality. // C Source # incrudeClass Mainapp: public wxapp {public: Virtual Bool OnInit (Void); private: wxframe * mainframe;}; import_app (mainApp)
Bool mainapp :: oninit (void) {mainframe = new wxframe (wxframe *) NULL, -1, "Hello wxwindows"); mainframe-> show (true); settopwindow; return true;}
#Python sourcefrom wxpython.wx import *
class MainApp (wxApp): def OnInit (self): mainFrame = wxFrame (NULL, -1, "Hello wxWindows") mainFrame.Show (true) self.SetTopWindow (mainFrame) return trueapp = MainApp (0) app.MainLoop ()
From the code above, we can see it. The method of implementation of WXWINDOWS and WXPYTHON is almost the same. Different are only the declarations of variables, and C is different from Python's syntax. Next, talk about WXWindows supported C IDE environments. Since Borland C Buildx has used wxwindows so Borland's C compiler should support it. In fact, the fact is true. Borland C 4.5 and 5.0 are supported. The IDE environment for using the most wide VC must also be supported. It is supported with 1.5, 4.0, 5.0 and 6.0. Of course, in fact, WXWINDOWS can also be used under .NET. There is at least there is no problem. In addition, using GCC's DEV-CPP also has good support to it, and even a package specially in WXWindows. You can install and use the package management of DEV-CPP directly. The above is just some IDE environments that can use wxwindows, there are still a lot, and this is not included here. For more introductions, you can look at WXWindows's own documentation, in detail, introducing and installation methods for different environments. It is worthy of its description documentation for WXWINDOWS. It can be said that its own documentation is available from the tutorial to the query documentation. To know, as an open source project, a free maintained project, the document can be so detailed and complete. So, when there is no Chinese document, I just read these English documents to learn. Moreover, until now, every time I see these documents, there will be many new feelings. Moreover, another worth mentioning that WXWINDOWS 2.4.0, WXWINDOWS 2.4.1, etc. have a lot of improvements. However, the introduction of the introduction documentation, etc. has almost no change. This is also a stability of its grammar. Not so that a new version will cause unavailable in the past code. Therefore, you don't have to worry about your code due to the problem, it will cause other people to read and compile. For multi-platform operating mechanisms. I think I have to introduce it. After all, I think this is also what we need to pay attention. If you look closely, you will see a directory such as MSW UNIX. In fact, when you import WXWINDOWS files, WXWindows will make different files more than different platforms. Below is a code of 63 lines in INCLUDE / WX / Button.h. #if Defined (__ wxuniversal__) #include "wx / univ / button.h" #Elif Defined (__ wxmsw__) #include "wx / msw / button.h" #Elif Defined (__ wxmotif__) #include "wx / motif / button.h" wx / motif / button.h "#elif Defined (__ wxgtk__) #include" wx / gtk / button.h "#elif defined (__ wxmac__) #include" wx / mac / button.h "#Elif Defined (__ wxpm__) #include" wx / os2 / button. " H "#elif defined (__ wxstubs__) #include" wx / stubs / button.h "#ENDIF
From the above code, you can see that if you transfer __wxmsw__ to the compiler, Button.h will continue to import Button.h from the MSW folder. This is how WXWindows supports multi-platform methods. Therefore, WXWindows running mechanism is more like an interpreter's running mechanism. Regardless of how the platform changes, the written people do not need to consider the platform's problem, the interpreter will more different platforms, convert the same code into different commands. Of course, anything in the world is bilateral, like WXWindows, also has its shortcomings. First, use WXWindows interfaces, often large, substantially 1m or more. Moreover, it will rise as the interface is complex. However, this depends mainly on how much the header you are using. There is usually no mutation. Of course, this is not a change. If you use ZIP, it is usually only 50% or less, 30%, this may be a problem that the compiler and code itself. It should be solved. In addition, WXWindows simplification will also bring a lot of trouble to people used. For example: wxnotebook * p_note = new wxnotebook (frame, -1); p_note-> addpage (new wxpanel (frame, -1), "1"); p_note-> addpage (new wxpanel (frame, -1), "2 "); p_note-> deletpage (0);
If you have not used or just use wxwindows, you will always think that this code will cause memory leakage. Because there is no explicitly deletion of the memory space generated by New. I thought I thought in first, but I found out. WXWindows automatically removes the space occupied by you when DELETPAGE (0). For those who are used to C , this does cause some confusion. However, this is also the kindness of wxwindows being misunderstood. The final problem is that WXWindows is not flexible in some ways. For example, it is almost unlikely to design an irregular window. Moreover, it is not as good as the right-click menu in WXTextCtrl, and it is indeed a bit troublesome. The above is some of the issues I found when using wxwindows. However, since Borland uses wxwindows. I think wxwindows will be more and more complete. Finally, thank you for reading. I hope that the seniors can advise a lot of articles for the child. I think wxwindows is not just a patent of C Buildx. You can also use wxwindows in your favorite IDE.
Studio Software Development Group Webmaster: Beidou Ringjun (Huang Haokui)