[Golang] [gui] Hands On GUI Application Development in Go [hands-GUI application development in Go] study notes 03- refused to pay "taxes IQ" decryption "GUI" Run Road

The original and foreigners did not seem much contact, ha ha ha, anyway, is the study notes, the following content is what I read in the course of this book, also written come. But honestly, it's kinda framework of my temper, ha ha ha.

Refused to pay "taxes IQ" decryption "GUI" Run Road

I am very busy

Project pressure, usually have to work overtime, some leisure time, but also to learn Qt. . . Therefore, the cost of learning can offer only two hours!

There are zeroing necessary?


Today's GUI just like water and air as usual, GUI framework are numerous. Its core technology works is not popular, we need to learn it?

Often commonplace things that are overlooked its importance; for example, people are often keen to upgrade the desktop operating system, after upgrading to ask, what is the biggest visual change? People tend to focus on GUI framework you're using Qt or MFC, ask the amount of code a GUI framework will account for what percentage of the amount of code you APP? People tend to spend a lot of time learning how to use the major GUI API library, may I ask how many people to discuss the general principles GUI to achieve?

Why do we use the GUI library, there will always be this way, that problem (for example: my control ye not refresh my cpu usage ye so high??) And the major mainstream GUI library upgrade frequent, more and more new GUI framework (eg: flutter) also endless burden do they not maintain it?

It seems that all the GUI software developers seem to have formed a kind of tacit understanding, everyone on the basic technical principles of secrecy, and an increase in body mass above GUI, never begrudge a bullet.

I think, no one knows why, unless you really understand GUI works. . .

Feasibility 2 hours

In order to complete the task within two hours, we need to choose a very small learning blueprint, paper, GuiLite 5 thousand lines of.

Unlike the mainstream market GuiLite common UI framework, their differences are as follows:

GuiLite vs mainstream UI
compare items GuiLite common UI
code size 5K + 1000K +
features + covering the core mechanism UI UI mechanisms underlying core UI controls + rich UI controls + WYSIWYG UI layout tools
use free play based on the core mechanism to find their own template processing
study focused on the core mechanics are familiar UI API usage
although, GuiLite body from the point of view very small amount, but two hours understand the meaning of the code 5000 lines, not reality; but fortunately can continue to do subtraction, remove various operations the system / display hardware adaptation layer, removing various UI controls, remove text, bitmap drawing, on the left two files: wnd.cpp (active 600 lines of code), surface.cpp (valid code row 500 ). From the point of view the amount of code, you can almost reach learning goals.
 

Code reading strategies


Yes, GuiLite is the core of these two documents, their responsibilities are as follows:

wnd.cpp responsible for managing the window, press the touch response / mouse down / release message
surface.cpp responsible for drawing the basic pixel and line / rectangle layer management and
we can think about, UI framework you use may be different, but the core the above two factors is not that it? Back to the topic, we only have two hours, how to allocate the code reading time?

we suggest:

 

20 to 30 minutes using a simple glance at surface.cpp, as to how the draw point / line / area, junior high school students know, we check it function like, as only one layer management function (set_frame_rect), suggest that you skip, give up read; because it requires a combination of HelloMario this case, making it easy to understand; the god of course can ignore this advice.

30 to 90 minutes using the read wnd.cpp, will implement all the functions of understand. Most of these functions are assigned exercises, logic itself is not strong, finished browsing experience these functions as soon as possible, focus on the need to focus on understanding two functions: connect, on_touch_down, on_notify; their functions are:

connect to create a window (this window may contain sub-window series), initializes all the necessary data structures
on_touch_down window message in response to a mouse press, comprising: a window which is to find the point in the process is the point (receive focus) of the window, the processing window times by points (loses focus) of
on_notify user registration call response function, for example: KeyPressVector

to sum up

Of course, understanding the core, it does not mean that we can immediately utilize, it's just a deeper level to help you explain the operating mechanism GuiLite help you accurately predict the behavior of UI may occur. How to effectively use? See also need GuiLiteSamples these "small is beautiful" examples of code, because they fully tap the core UI, so often in the amount of 100 lines of code from top to bottom, which will hopefully generate some inspiration to everyone.

Often there is no absolute shortcut to the world, but there may be some ways more with less. This is our experience, for reference only, to find their own mode of relaxation demanding for two hours, I believe we can grasp the core principle of GuiLite (mechanism); we believe that these core principles has a certain universality, whether you are learning Qt, MFC, Winforms, I believe will be helpful, I wish you successful study!
----------------
Original link: https: //blog.csdn.net/idea4good/article/details/89079290

 

Guess you like

Origin www.cnblogs.com/landv/p/11839636.html
GUI