Paradoxically, paleontology is a young and rapidly developing science. Every year, fossil researchers make many discoveries and put forward new hypotheses. "Lenta.ru" invites you to recall the most interesting paleontological events of the past year.

How dinosaurs disappeared: new versions

Solving the causes of the extinction of dinosaurs is one of the most popular areas of paleontological research. Most experts agree that volcanoes and meteorites were to some extent involved in the total disappearance of the Mesozoic giants. But sometimes representatives of other sciences join paleontologists, and here the most interesting begins.

So, the Harvard theoretical physicist Lisa Randall (Lisa Randall) is confident that the Cretaceous-Paleogene extinction that rid the world of dinosaurs. It seems somewhat eccentric to blame the killing of dinosaurs on this hypothetical cosmic substance, which does not interact with anything and is not recorded by any instruments, but the arguments of Randall and her colleagues deserve at least mentioning them.

According to physicists, our galaxy, known by the romantic name of the Milky Way, is traversed by a disk of dark matter. Invisible, it still causes gravitational perturbations in celestial mechanics, which leads, in particular, to various statistical bursts, for example, a sharp increase in the probability of comets colliding with the Earth. Such a surge is actually recorded every 35 million years, and one of them falls exactly at the end of the Cretaceous period. So the meteorite that killed the dinosaurs could indeed have been “launched” by dark matter.

Image: Lisa Randall, Matthew Reece, arXiv: 1403.0576

However, there are other versions as well. A group of British paleontologists from the Universities of Edinburgh, Birmingham, Oxford and London believe they are giant lizards. If the same meteorite had fallen a little earlier or a little later, everything could have been different.

The fact is that 66 million years ago, at the time of the fall of the Chicxulub meteorite, the main contender for the role of a dinosaur killer, the terrestrial Mesozoic ecosystems were in a state of severe crisis. The lower floors of their trophic pyramids were knocked out, the species diversity of the fauna was steadily decreasing, and the conditions for a new burst of speciation were just emerging. However, a global catastrophe caused by a meteorite put an end to the usual course of things, and when the dust settled, mammals had to create new species. One way or another, thanks to chance or dark matter, our furry ancestors got a chance and realized it brilliantly.

Paleozoic love

Don't think that all paleontologists are focused solely on disasters and extinctions. Among them there are also very positive people who study, for example, sex and sexual positions of the most ancient inhabitants of the Earth. And their research is capable of surprising no less than the cosmic perturbations that cost the lives of dinosaurs.

It turns out that one of the very first postures used by vertebrates for procreation was the famous missionary position. Dr. Kate Trinajstic from the Australian University of Curtin has found in the rocks of the Devonian period (and this is no less than 400 million years ago) fossilized appendages of shellfish that served as penises. Having reconstructed the passionate inhabitants of the Devonian in all details, the inquisitive researcher came to the conclusion that the most comfortable position for copulation of these fish was "belly to belly."

Image: John Long

However, even armored fish tried to diversify their marriage relationship. Therefore, representatives of another Devonian species - Microbrachius dicki - copulated shoulder to shoulder or, more precisely, fin to fin. Male microbrachii grew L-shaped appendages for themselves and carried their partners in, "hugging" with their front fins and docking with their genitals. Another Australian paleontologist, professor at Flinders University, John Long, managed to establish this.

Classic design

In general, the fossils of the Paleozoic living creatures that inhabited the Earth long before the dinosaurs, in the past year presented one surprise after another. What is worth, among other things, the discovery of a complex and practically modern cardiovascular system in the Cambrian arthropod Fuxianhuia protensa!

We, who have absorbed the evolutionary wisdom of school textbooks since childhood, still believe that the older, the simpler and more primitive earthly organisms were. Meanwhile ... “This animal looks quite simple, but its internal organization is carefully thought out. For example, several arteries go to the brain - a pattern very similar to modern crustaceans, ”says Professor Nicholas Strausfeld of the University of Arizona. In his opinion, the vascular system of Fuxianhuia is even more complex than that of many modern crustaceans. However, the seeming paradox is a scientist.

“Today, different groups of crustaceans have differently arranged vascular systems, but they all date back to what we see in Fuxianhuia. With the course of evolution, some body segments of these animals specialized in specific tasks, others lost their significance, and the elements of the vascular system in them became less complex, ”the Russian portal PaleoNews quotes Professor Strosfield.

But if it were only about the vascular system! It turns out that it was also no worse than the modern ones. This became clear thanks to the uniquely preserved fossils of the ancient Chinese marine predators, the anomalocaridid \u200b\u200bLyrarapax unguispinus, 500 million years old. Three of their fossil representatives were studied by the same American professor, who found that the predators of the Cambrian seas thought with exactly the same brain as modern velvet worms - onychophores.

Image: Nicholas Strausfeld

Today we turn to what has changed in our understanding of the only (permanent) natural satellite of the Earth since the dawn of the cosmic era.

Four decades after man first landed on the moon, a whole bunch of things happened! Several programs and vehicles have changed, international missions plow the vastness of space, and unmanned vehicles are exploring the solar system. Over the past 20 years, NASA has not paid much attention to the Moon, but with the help of the Lunar Orbiter (LRO) over the past ten years, we have collected a lot of information about it.

Over the years of observations, we have found that the Moon is not such a cold dead world as it seemed to us when the Apollo astronauts left footprints on it from 1969 to 1972. The moon is not the same! Here are some great things we've learned.

Five years ago, studying footage from the LRO (Lunar Orbiting Probe) Narrow-Angle Camera, scientists discovered 14 cliffs across the entire surface, similar to the seventy that were in the Apollo images. These "lobe-shaped ledges" have led scientists to believe that the moon is shrinking as it cools. Thousands of such scarps have been discovered over the past few years, and their location suggests that they form in response to Earth's tidal pull.

It turns out that the lunar surface is dotted with more than two hundred pits 900 meters (984 yards) in diameter. The first three were detected by the Japanese Kaguya spacecraft, the rest were calculated using a computer algorithm from the LRO images. How they formed is unclear, possibly from lava outcrops. Perhaps future researchers could use this to protect against radiation and micrometeorites.

Here's what we've learned over the decades about how the Moon came to be: a huge celestial body (about the size of Mars) crashed into our planet. Obviously, debris flew into space because of this. As a result of the collisions of these debris, the Moon was formed. Last year, scientists were able to tentatively mark the trail of the striking body, sometimes called Theia, inside the moon rocks. It turned out that the content of oxygen isotopes in samples collected at three Apollo bases is significantly different from that on Earth.

Craters dot the entire solar system, but what is remarkable is that the frequency of their appearance on the surface of planets is not the same, depending on where you are. Sometimes stones are burnt in the atmosphere. Sometimes this is the position of the object (say, the center or periphery Solar system) affects how frequent meteor showers are. One of the objectives of the LRO is to predict the frequency of craters on the lunar surface.

It turned out that the Moon is not such a deadly dry place, there is a little water ice there. It is not enough - even less than in the desert - but it is there. The main question is whether it will be enough to provide a lunar colony. Earlier this year, the LRO discovered that hydrogen, a trait of water, is more prevalent in the study region, which was the southern hemisphere, on the slopes facing the pole. The maps he compiled will be key in the selection of sites for future human settlements.

You don't think this is all about nutrition, right? Of course, but this fact comes first for a reason. It's all too easy to get lost in the endless details of nutritional science and not notice that you read a book (or, let's be honest, Facebook comments) well past midnight. And this is bad - in short, here's why.

For this there is a great German word "zeitgeber", "pacemaker". If you spend your work time indoors, and in the evenings spend time watching TV or surfing the web, if you are alone with yourself all day, and in the evening you actively communicate, or maybe you sit almost motionless, loading the body in the evenings, then you very effectively knocking down the three key pacemakers in your brain. So instead of discussing sleeping pills, consider how these systems work.

The main color for them is blue. Light of this wavelength suppresses the body's production of melatonin. During the day when we see blue skies, we receive a powerful (and free) stream of blue radiation from the Sun.

And if you get enough of it in a day, and in the evening do not overdo it with artificial lighting, then hormones, the content of which should change during the day (including both melatonin and cortisol), will behave correctly.

A randomized study conducted in January 2015 found that people who use iPads before going to bed had a harder time falling asleep. They have a shorter REM ("paradox") sleep phase, and in the morning they feel less rested. Soon, iPhones and Amazon tablets have a built-in blue dimming function. The authors of Examine.Com used free applications that automatically lower this brightness, such as f.lux, tried smart lamps and yellow glasses, but we have to admit that the gadget giants reacted well themselves.

From the word "belly"

Intestinal microflora. Yes, yes, it is terribly topical and so new ... But tell Hippocrates about this, who wrote 2.5 thousand years ago that “all diseases begin in the intestines”. The intestines have been relevant since our ancestors developed these long, folded tubes for efficient digestion of food and absorption of nutrients.

In recent decades, we have begun to understand that the role of the intestine is far from limited. Studies of both healthy and sick people are beginning to discover the effect of intestinal microflora on the effectiveness of physical activity, and physical activity - on the microflora. The ability of intestinal bacteria to interact with the brain through the immune, nervous and endocrine systems has been demonstrated. There is growing confidence that healthy microflora - and possibly some probiotics - can improve depression and non-depression, maintain a healthy body weight, prevent chronic disease, and more.

However, maintaining a healthy microflora is more difficult than simply consuming certain probiotics. The bacteria they contain rarely, if not never, colonize the gut, and while fiber is good for the general population, some probiotics can cause digestive upset - especially if taken in large quantities and without appropriate dosage adjustments. Moreover, the intestines need not only plant foods: butyric acid (which is released from oil or produced by the same microflora) allows maintaining the state of the mucous membrane. Other components of meat foods (such as the amino acid glutamine) are also important for gut health.

The advice is extremely simple: Be mindful of your gut health. Many details remain unclear, since the study of the intestine and its microflora has been seriously developed in the last five years, and much in this area is still unknown. However, we can confidently say that a diet rich in not too highly processed plant and animal foods will be well accepted by the intestines and its bacterial population.

Berry revolution


Exotic "superfruits" such as the acai fruit have become the subject of universal veneration. However, much cheaper (and often just as delicious) berries can be just as healthy.
Before moving on to the story about berries, it is worth making one important note about antioxidants in general: in this area, "more" does not mean "better."

When assessing the effects of consuming berries (and some other plant foods), officials and doctors are accustomed to relying on the Oxygen Radical Absorbance Capacity (ORAC) scale. However, in recent years, it had to be abandoned, as it turned out that this scale does not correlate with real health benefits. Seeing on sale "magic goji berries" with some incredible ability to neutralize free oxygen radicals, better save your wallet.

Now, in fact, to the berries. Not only are they beneficial for certain conditions (like cherries, for Alzheimer's), but they also help maintain normal blood sugar levels and blood pressure. They are also recommended for healthy people. Some of their beneficial effects may be associated with antioxidant activity, but most are caused by specific components in their composition, such as anthocyanins, which give blueberry color. Whatever their mechanism of action (for example, when it comes to stimulating cognitive abilities, berries can protect neurons from toxin damage, improve blood flow to the central nervous system or signal transmission by synapses), a diet rich in berries will certainly do more good than harm.

Berries, especially those rich in dark anthocyanins, show excellent ability to prevent various diseases, support cognitive function, etc. This does not mean that they are deliberately "healthier" than other fruits, but they have found more advantages than any other food.

Insulin, obesity and doubt

A low-carb diet itself is not so bad: in terms of blood sugar control, it is certainly better than the indiscriminate consumption of fast food. But something about the promises of the adherents of such a diet raises doubts - namely, their claims that with the same number of calories consumed, it allows you to lose more weight than any other diet.

How exactly? By lowering insulin levels.

At the same time, until the fall of 2015, this “carbohydrate-insulin hypothesis” had never been tested in controlled randomized tests. It was only recently that National Institutes of Health (NIH) researcher Kevin Hall (Kevin Hall) published the results of study 00350-2), during which scientists strictly monitored the diet of each subject, comparing the effectiveness of a diet with a high (about 350 g) carbohydrate content versus a diet with low (about 140 g) their content - with an equal amount of calories consumed.

Each participant spent two weeks on this diet, and careful monitoring of the entire environment in which they were during the experiments ensured good reliability of the results obtained.

And these results found virtually no difference in either weight loss or fat loss. According to advocates of the low-carb diet, the problem may be too short a time period, too small a sample, or not cutting carbs enough. On the one hand, these are quite appropriate objections (although conducting experiments with long-term isolation of a large group of people can cost a huge amount). On the other hand, it cannot be denied: the study still showed that there was no difference in terms of weight loss, and showed this in strictly controlled conditions.

Could longer experiments reveal some kind of unexpected metabolic breakdown in the low-carb group? Well, anything is possible, but even in this case, insulin will most likely have nothing to do with it. Its decrease was recorded in such people and in the experiments described above, without leading to any significant weight loss.

This is not to say that these controlled trials have hammered the final nail into the lid of low-carb diets. However, they checked to see if there was anything real behind the promise of additional weight loss by proponents of such nutrition. As it turned out - not worth it. However, there are other benefits of a reduced carbohydrate diet.

Fuss around red meat

At the end of 2015, the World Health Organization (WHO) circulated a summary report 00444-1 / abstract), which caused a real media storm around the world. Even if you do not read the news on principle, you have probably come across discussions and headlines on Facebook, they say, "Scientists have discovered that red meat is carcinogenic."

In such high-profile statements, almost every word is wrong. First, there was nothing new in the WHO report: it only summarized data obtained over the past 20 years, and was devoted to the increased risk of developing rectal cancer with the use of various red meat products. In general, they did not "find" anything, but simply counted the previous figures. Second, this count combined data from medical statistics, animal experiments, and cell culture experiments - truly wholesome and large-scale experiments on the long-term effects of red meat consumption, both were not available. not.

In addition, the report separately spoke about processed products of red meat (they were attributed to carcinogens of group 1) and - separately - about not processed (it turned out to be a line below, in group 2A). It is worth remembering that the title "carcinogen" does not mean an unequivocal danger of the product. In fact, a huge number of common substances are potential carcinogens, which we do not even think about giving up, including aloe or alcohol.

As always, the question is only in the quantity and circumstances of use. For example, substances present in some plants are able to markedly reduce the carcinogenic hazard of red meat (countering the negative effects of N-nitrosodiethyleneamine and heat-treated products). Avoiding over-fried meat and meat products will further reduce the risk.

Red meat cannot be categorically declared harmful. A slightly increased risk of developing rectal cancer is associated with the consumption of highly processed, deep-fried meat. Combining meat with plenty of vegetables will help reduce its potential negative effects.

These are just five of the dozens of topical nutrition-related topics that have gained momentum in recent years. Each year brings new work and new data, forcing us to delve into their results with enthusiasm, looking for truly valuable finds. This is true, no sarcasm: it brings us great pleasure both reading articles and looking for interesting connections.

During the election campaign, the films of journalist Andrey Kondrashov “Valaam”, “Crimea. The Way Home "," Putin ". In the pictures, the president told stories from his biography and loved ones, shared his vision of the communist ideology. the site publishes the revelations of Vladimir Putin, who won the presidential election on March 18.

Gangster Petersburg

While working in St. Petersburg in the 90s, Vladimir Putin had to sleep with a gun in his dacha. In the film, a friend of the president, cellist Sergei Roldugin, told about this episode of the biography, RIA Novosti writes.

Putin, commenting on this information, noted that there are many far-fetched things about “gangster Petersburg”, but in general “the situation was militant”. According to Putin, in his country house he went to bed with a pump-action gun, it's true.

“But the times were like that. God protects those who are taken care of, ”the president said.

During unemployment I wanted to tax

Putin told how he almost began to earn money as a taxi driver in St. Petersburg, when he left his job from the mayor's office after the loss of Anatoly Sobchak in the mayoral elections.

“I even thought what to do, maybe work in a taxi? I'm not kidding where to go. Two small children. Therefore, when I was offered to move to Moscow and take up legal affairs in the presidential administration, I agreed and came, ”Putin said, writes Gazeta.Ru.

According to him, although he never wanted to leave St. Petersburg, he is grateful that he was invited to work, and he was able to settle in Moscow.

About the place at the "parasha"

The President of the Russian Federation in the film "Putin" noted that the "place" of each country and its national interests in the world should be determined not by ultimatums, but by means of dialogue. “Who has whose place and where and whose national interests should be decided not with the help of shouts and ultimatums, but with the help of dialogue,” he said.

“They always try to show us where we belong,” the head of state said. Putin compared the attitude of a number of countries towards Russia after the collapse of the USSR to the criminal environment, recalling the footage from the film "Gentlemen of Fortune", where one convict says to the kindergarten teacher who is in the cell: "Your place is at the bucket!"

“We don't like this place,” the president stressed. "We generally disagree with this way of posing the question."

Grandfather "cooked" with Lenin and Stalin

Paternal grandfather Spiridon Putin worked as a cook for Vladimir Lenin and Joseph Stalin, and his maternal grandfather showed compassion for the enemy during the First World War.

“Yes, my grandfather worked as a cook first for Lenin, and then for Stalin in one of the dachas in Gorki near Moscow,” Putin said in the film.

The president himself, according to him, was not in these residences, “but my father told me that when my grandfather worked with Stalin, he went there to visit him, and he was allowed there, he watched all this life,” reports TASS.

Recalling his maternal grandfather Ivan Shelomov, the president said that he fought during the First World War on the Russian-Austrian front. “He saw that an enemy army soldier was aiming at him from a trench opposite, and his grandfather fired first,” Putin said.

The continuation of this story was told by director Nikita Mikhalkov. According to him, Ivan Shelomov, hearing the moans of a wounded Austrian from the enemy trench, did not finish him off with a shot, but crawled over to him and bandaged his wound, and he kissed his hand in gratitude. “And this compassion is characteristic of the Russian people. I think that this is a very characteristic part of our common mentality, ”Putin summed up the story, writes bfm.ru.

Presidential fishing

Russian Defense Minister Sergei Shoigu denied suggestions that the 20-kilogram pike caught by the Russian president in 2013 was allegedly “hooked on purpose. He assures: it was not a staged action, they write "Vesti".

“You don’t have to go so far to get a ride. Here on the Moskva River I got into a boat - and they put you on board. Why fly there, then get there by cars, all-terrain vehicles, go by the river, "Shoigu joked.

Talking about the pike caught in Tuva then, Putin admitted that the fish, which became his largest catch, really weighed 20 kilograms.

“I know that there were doubts about the weight of 20 kilograms. But she was weighed. And I think that the weight was hardly hung from below. True, there was still a decent fish inside, that is, the pike swallowed it. Be that as it may, this is my greatest pride, because I have never caught any bigger fish, ”said the President of the Russian Federation.

A Primitive Bible Excerpt

In the film "Valaam", the president called the Moral Code of the builder of communism "a primitive excerpt from the Bible," and compared the content of Lenin's body in the Mausoleum with the Christian tradition of venerating relics.

According to Putin, communist ideology is very akin to Christianity. “Freedom, brotherhood, equality, justice - this is all inherent in the Holy Scriptures, it is all there. What about the Code of the Builder of Communism? This is a sublimation, a primitive excerpt from the Bible, they did not come up with anything new there, "the president explained.

GRU fighters and marines secretly transferred to Crimea

Russian President Vladimir Putin said that in 2014, in order to disarm the Ukrainian army in Crimea, the Russian authorities secretly transferred units of the Marine Corps and the GRU to the peninsula.

Russian President Vladimir Putin said that the return of Crimea to Ukraine is impossible under any circumstances.

“What are you, crazy, or what? There are no such circumstances and there never will be, ”he said in response to a question about the possibility of such circumstances.

Yanukovych was saved from an ambush

Vladimir Putin spoke about the rescue operation for ex-President of Ukraine Viktor Yanukovych. Russian surveillance services recorded Yanukovych's whereabouts as he headed to Crimea. “But when they showed me the map, it became clear that he would soon run into an ambush,” Putin said.

Then it was decided to direct Yanukovych's motorcade towards the coast.

“We gave them an indication of where to go - by motorcade ashore. And they deployed a helicopter group with a special forces detachment on board, ”the Russian leader added.

At first Yanukovych did not want to leave Ukraine, but when it became clear that there was “no one to negotiate with” in Kiev, he was transported to the territory of Russia.

Began to pray on my knees

Putin single-handedly made the decision to storm the theater center on Dubrovka seized by terrorists in October 2002, despite initial reports that the gas released into the hall had no effect.

“The plans were to take a bus with hostages, go to Red Square and there, on Red Square, shoot them, in order to influence the leadership, the special services. Of course, we could not allow this to happen, "Interfax quotes the words of the Russian President.

According to Kondrashov, after the interview, Putin, already without microphones, said that, having given the command to start the assault, he went to the chapel in the first building of the Kremlin and for the first time in his life began to pray in front of the icons on his knees. After what time the FSB director reported to the president: the gas worked, the assault was going according to plan.

Helicopter of Putin with Sechin fired at in Chechnya

The helicopter of Russian President Vladimir Putin came under fire from militants in the early 2000s. The incident took place during his visit to a height in Chechnya, where the Pskov paratroopers died heroically. After that, the head of state personally met with the parents of the killed soldiers and promised them to visit the place where the paratroopers were killed, despite the fact that the height still remained in the rear of the militants. When the presidential board arrived at the scene of the feat, he was fired upon.

“I decided that it was actually a fireworks, because the New Year was. The pilots have already said: “What a fireworks, we are under fire,” the Russian leader shared.

As the head of Rosneft, Igor Sechin, who accompanied the president at the time, said that after the shelling, Vladimir Putin instructed to prepare a backup route by cars, but on the way back a land mine went off. Sechin noted that no one was hurt then, by a lucky chance, Izvestia writes.

Submarine "Kursk". Why did she "drown"?

"After the collapse Soviet Union we faced enormous difficulties in the economy, in the social sphere, and in the army, of course. All this could not but touch the army. The tragedy of the Kursk is also a manifestation of the general state of the armed forces, ”said Russian President Vladimir Putin.

He called the incident a huge tragedy: “What a sin to hide? We know very well the state of the armed forces at that time. Therefore, frankly speaking, there is nothing surprising, but the tragedy is colossal. So many people died, ”writes Rosbalt.

The invaders demand landing in Sochi. "Shoot down!"

On February 7, 2014, an hour before the opening of the Olympics, Vladimir Putin was informed about the hijacking of a passenger plane of the Turkish airline Pegasus. At this time, the president was traveling in a bus with the IOC leaders to the Fisht stadium in Sochi.

“Somewhere in the middle of the way, the adjutant handed me the phone, one of the heads of the operational headquarters for the security of the Olympic Games called. And he reports: a plane has been seized, which should follow from Ukraine to Istanbul. The invaders demand landing in Sochi, ”said the head of state.

The pilots managed to report that one of the passengers had a bomb. The siloviki decided to raise military aviation. “I asked: what do you suggest? And the expected answer: "In accordance with the plan provided for in the event of such a development of the situation ... Shoot down," - said the president.

According to Putin, he ordered to act according to the plan. However, very soon I received another call and learned that it was a "drunken trick" of one of the passengers, and the liner would soon land in Turkey.

Legend of the translator

On December 5, 1989, a crowd of aggressive people approached the KGB mansion in Dresden in order to get the archives of the secret service. Soviet intelligence officer Vladimir Putin had to negotiate with people, Vesti writes.

“Going out to the people, I asked what they would like. They said they would like to search the building. And I replied that this building belongs to the Soviet army, it is not subject to inspection in accordance with the intergovernmental agreement, "Putin said.

“I was asked why I speak German so well? I had to, as they say in such cases, “answer according to legend,” say that I am a translator, ”the president recalls.

Fact

Films about Russian President Vladimir Putin were shown and published during the election campaign. The head of the CEC, Ella Pamfilova, said that posting films about Putin on social networks is not a violation, since electoral legislation does not regulate the Internet.

Vladimir Putin won 76.66% in the presidential elections after processing more than 99% of the ballots (morning of March 19). Ahead is the inauguration and six years of the fourth presidency.

In this tutorial, we learned:

Use standard Visual Basic message boxes to display information.

Use input boxes for the simplest collection of information.

Create custom dialog boxes.

Integrate the class of dialog boxes in future applications.

LESSON

Mouse operation

Handling mouse events

Dragging

OLE drag and drop

Making an Easter Egg

Mouse events

So far we have had to deal with two mouse events, Click and DblClick (double click). This lesson will cover other mouse events used in Visual Basic. These include moving the mouse and pressing buttons - alone or simultaneously with the Shift, Alt and Ctrl keys. These events are handled in the MouseDown and MouseUp procedures, as well as MouseMove. In the last event, it is convenient to show and hide tooltips when the mouse pointer hovers over the buttons on the toolbar. Different elements support different mouse events. This lesson covers basic mouse events along with how to apply them. In particular, we will write a small program that handles the drag and drop routine. After that, you will have a good idea of \u200b\u200bwhat mouse events should be used in your elements.

Click event

The Click event is generated when the element is clicked. Almost all Visual Basic elements that are displayed at runtime support the Click event, but it is most commonly used for buttons. The code in the button's Click event procedure is executed when that button is pressed with the mouse. For example:

Private Sub cmdOK_Click ()

DblClick Event

The double-click event, DblClick, is triggered when two quick successive mouse clicks occur. Double-click sensitivity is set when you configure mouse settings in the Windows Control Panel. In lists, this event is often used to view properties and to add and remove selected rows. For example:

Private Sub lstmembers_DblClick ()

Dim m As clsMember

Set m \u003d New clsmember

m.MemberName \u003d lstMembers.Text

m.ShowMemberProperties Set m \u003d Nothing

Typically, double-clicking the mouse is used to quickly execute a menu command or press a button.

DragDrop event

The DragDrop event is raised when an object being dragged with the mouse is dropped. The DragDrop event procedure has the following syntax:

Private Sub target_DragDrop (Source As Control, X As Single, Y As Single)


Pay attention to three parameters - before doing any further actions, you can check their values. The Source parameter contains the name of the element dropped onto the current object. The X and Y parameters determine the coordinates of the mouse pointer at the time the DragDrop () event is fired. Using them, you can define the location of the element on the receiver. For more information on drag and drop, see the next section of this tutorial.

DragOver Event

The DragOver event is raised when an object is dragged over an element. The event procedure has the following syntax:

Private Sub target_DragOver (Source As Control, X As Single, Y As Single, State As Integer)

Source - the name of the dragged object. The X and Y parameters determine the coordinates of the mouse pointer. The integer State variable defines the state of the dragged object with respect to the event receiver.

State parameter Appointment
Object enters the boundaries of the source
Object leaves source boundaries
The object is dragged within the bounds of the source

This event is useful for letting users know if the object being dragged can currently be dropped. For example, it is hardly worth allowing dropping an object on a button; when the button's DragOver () event is generated, you can check the Source parameter and set the DragIcon property to the "no dropping" icon.

MouseDown event

If you press and hold the mouse button, the MouseDown event is raised. The MouseDown () event procedure has the following syntax:

Private Sub target_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single).

As with other mouse events, the X and Y parameters determine the position of the pointer. The integer Button parameter takes one of three values.

The sum of these values \u200b\u200bdetermines the various keyboard shortcuts. For example, a value of 6 indicates that Ctrl and Alt were pressed, while a value of 7 indicates that all three control keys were pressed simultaneously. When checking the Shift parameter, the And keyword is often used. With nested If ... Then constructs, you can track different keys. For example, a snippet:

If Shift \u003d 6 Then

is equivalent to the following:

If Shift And 6 Then

MsgBox "Ctrl and Alt keys pressed"

MouseMove event

The MouseMove event is generated when the mouse moves over the element. In its procedure, you can change the state of the element under the mouse pointer, for example, recolor an unlocked button green when the mouse pointer passes. The event procedure has the following syntax:

X As Single, Y As Single)

The parameters for this event are identical to those for the MouseDown event. In the following example, the title of a form changes when the mouse hovers over the Exit button:

Private Sub cmdExit_MouseMove (Button As Integer, Shift As Integer, _

X As Single, Y As Single)

Me.Caption \u003d "Click to close the application"

You can include similar code in the MouseMove event procedures of other elements. Before the advent of the tooltip mechanism, I often used this event to display help messages in the status bar.

MouseUp event

When you release the pressed mouse button over the element, the MouseUp () event is raised. The event procedure has the following syntax:

Private Sub target_MouseUp (Button As Integer, Shift As Integer,

X As Single, Y As Single)

Its parameters are the same as parameters MouseDown and MouseMove. Many newer Windows 95 applications use this event instead of Click. For example, you can include an End statement in the MouseUp event procedure so that the user can continue to use the application even after clicking the exit button. To cancel the exit, move the mouse pointer away from the button and release the pressed mouse button. In this case, the End statement is not executed because the MouseUp event is being raised on another object.

Dragging

Drag and drop is increasingly used in Windows applications (for example, to adjust the position of the divider bar in Windows Explorer). Thanks to him, many operations are performed faster and easier. Making a Visual Basic application drag-and-drop is not that difficult. The following example shows how this is done:

1. Create a new Standard EXE project.

2. Set the Name property of Form1 to frmMain and the Caption property to Drag.

3. Place two lists of the same size on the form. One should be at the top and the other at the bottom of the form.

4. Set the Name property of the top list to lstA, and the DragIcon property to \\ Graphics \\ Icons \\ DragDrop \\ Draglpg.ico.

5. Set the Name property of the lower list to lstB and the DragIcon property to \\ Graphics \\ Icons \\ DragDrop \\ Draglpg.ico. A sample form is shown in Fig. 11.1.

Figure: 11.1.Drag-and-drop application

6. Add the following snippet to the Form_Load () event procedure:

Private Sub Form_Load ()

lstA, AddItem "Apples"

lstA.AddItem "Peaches"

lstA, AddItem "Oranges"

7. Add the following snippet to the lstA_MouseDown () event procedure:

Private Sub lstA_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)

If lstA.ListCount\u003e 0 Then

8. Add the following to the lstA_DragDrop () event procedure:

Private Sub lstA_DragDrop (Source As Control, X As Single, Y As Single)

If Source \u003d lstB Then

lstA.Additem lstB.Text

lstB.RemoveItem lstB.ListIndex

9. Add the following to the lstB_MouseDown () event procedure:

Private Sub lstB_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)

If lstB.ListCount\u003e 0 Then

10. Add the following to the lstB__DragDrop () event procedure:

Private Sub lstB_DragDrop (Source As Control, X As Single, Y As Single)

If Source \u003d lstA Then

lstB.Additem lstA.Text

lstA.RemoveItem lstA.ListIndex

11. Save and run the project.

The upper list contains several lines with the names of the fruits. You can click on any line and drag it to the bottom list. When the mouse pointer is over it, release the mouse button. Then the rows can be dragged back to the top list (Figure 11.2).

Figure: 11.2.Dragging rows

The key to this program is the Drag method. Note that in the MouseDown () event procedure it is called with parameter 1, which tells the element to start dragging. If the parameter is 0, dragging stops. In other words, to stop dragging, set the Top and Left properties to the x and y coordinates and call the Drag 0 method. This simulates the movement of the object, when in fact it is performed in the DragDrop () event procedure.

Our conversation about drag and drop is coming to an end. Try experimenting a little - have fun and at the same time watch what is happening. You might want to use drag and drop in your projects. Notice the DragIcon property of the source, that is, the object being dragged. If you do not set it, you will only see the outline of the dragged object.

OLE drag and drop

Windows 95 introduces a new, more versatile type of drag-and-drop — the so-called OLE drag-and-drop. OLE stands for Object Linking and Embedding, which means linking and embedding objects. This type of drag-and-drop allows you to move text, files, and objects between elements that act as OLE containers — lists, text boxes, and graphics boxes. There are some OLE drag-and-drop capabilities in the Visual Basic program window. When you move files from Windows Explorer to the C drive folder, you also perform an OLE drag and drop operation.

OLE dragging creates a global object containing the dragged data. In the OLEDragDrop event procedure, you can access the contents of the DataObject. Let's take a closer look at OLE drag and drop methods and events.

OLEDrag method

The OLEDrag method starts an OLE drag and drop operation. It is called when you want to copy or move OLE data between two OLE containers. The method has the following syntax:

object.0LEDrаg

where object is the OLE container object that is the source for the drag-and-drop operation.

OLEDragMode Property

You can use the OLEDragMode property to find out if an object is capable of acting as an OLE drag source and whether the OLEDrag operation will be performed manually or automatically. The property can take the following values.

OLEDropMode Property

OLEDropMode is similar to OLEDragMode. By setting this value, you determine the type of OLE drop event handling in your application. The property can take one of three values.


Close