Monday, January 27, 2020
Relationship Between Skeletal and Muscular System
Relationship Between Skeletal and Muscular System Locomotion of the human body is a result from the alternate contractions and expansion of the muscles[1]. These contractions are generally caused by conversion of chemical energy to forces and moments therefore creating[1]. Based on the properties of muscles (structural and contractile), the muscular system of the human body is classified into three categories ; skeletal muscle, smooth muscle and cardiac muscle.[1 2]. In this essay the anatomical structure, contraction mechanism and also a disease of the skeletal muscle is explained. Generally in the human body nearly 40-45% of the total body weight comprises of the skeletal muscles and the rest 10% is made up of the of smooth muscles[2]. These muscles help keeping the skeleton intact by distributing the external or internal loads evenly across the joints which are held by tendons that help in the transmission of force muscles to the bones or joints, thus providing strength for human motion[1]. Skeletal muscle is surrounded by a membrane called the epimysium, which consists of bundles of fascicles enveloped by a dense tissue called the perimysium[12]. These fascicles are made up of individual structural units that are long, cylindrically shaped multinucleated cells called muscle fibres[2]. The diameter of the muscle fibres varies from 1- 100ÃŽà ¼m and has average length of 20cm[2]. Each muscle fibre is subdivided into thousands of myofibrils that are packed together in the form of cylindrical bundles by a thin membrane called sarcolemma[1,2 3]. Skeletal Muscles cannot be repaired in case of any damage but satellite cells which are located beneath the basal lamina of the myofibers have the ability to form new muscle fibres however the strength will not be same as the old skeletal muscle[4]. The myofibrils consists of many repeating units along its length called sarcomeres which is made up of thick and thin filaments of varying size having contractile proteins called actin and myosin respectively[1,2 3]. According to nuclear magnetic resonance studies the structure of the actin was found to be ÃŽà ±-helical in shape but certain other experiments using scanning transmission electron microscopy(STEM) prove that actin appears to be double helical in structure[5]. Thick filaments on the other hand is made up of protein molecules called myosin with an average molecular weight 200,000[6]. The thick and the thin filaments are arranged in a parallel pattern in a sarcomere as given in figure 2 this gives to the rise of dark bands called the A-bands which lie in the central region of the sarcomere[12]. The darkness in this band is because of the presence of the thick filaments and the overlapping of the thin filaments. The thin filaments are connected to the Z line, which is made up of complex and dense protein structures. These Z lines have an unique property of not allowing easily the passage of light. Another set of bands is the I bands, these are gener ally light bands because of the presence of thin filaments and they lie generally between the A band and the Z line. Titin molecules are polypeptide chains that link the Z line with the myosin filaments in this region and center them in a sarcomere[1,27]. These titin molecules is responsible for generation of a passive force upon application of any load [7]. The striated appearance of the skeletal muscle is because of the presence of these bands. Some additional structures that are present are the H zone and the M line. The H zone lies in the centre of the A band and this region consists of only thick filaments. This zone is bisected by a relatively narrow band called the M line which is a result of the cross linking of proteins with the central region of the thick filaments. Recent studies which used electron micrographs to determine the ultrastructure of the M line it was found that the M line had a width of 750 A and the thickness of the M line was large as a result the opacity o f this line was high[8]. The Neuromuscular junction The neuromuscular junction is the site of action of motor neuron (somatic efferent neurons) with respect to the muscle fibres. The axon terminal of the motor neuron bifurcates into several smaller branches, each of which forms a junction with the muscle fibre. Thus by this manner a single neuron is able to excite several muscle fibres at the site. The motor neuron and the muscle fibres at the site of the action are together known as the motor unit. The neural impulses from the axon branches are received by the muscle fibre at a site known as the motor end plate. The junction comprising of the axon terminal and the motor end plate together form the neuromuscular junction. The axon terminal contains a neurotransmitters (acetylcholine ( ACh)) in vesicles similar to those found at synaptic junctions. The nerve plasma membrane is triggered by an action thereby opening the voltage sensitive calcium channels and allowing the calcium ions to diffuse into the axon terminal. The calcium ions bind to proteins and cause the release of ACh from the axon terminals into the muscle fibers. The diffusing ACh binds to the receptors located in the motor end plate and causes the opening of the ionic channels. The opening of the ionic channels causes the movement of sodium and potassium ions, due to the differential electrochemical gradient there is a higher influx of sodium than the efflux of potassium causing a local depolarization of the motor end plate which is called as end plate potential. The motor end plate has an enzyme known as acetylcholinestrase which causes the breakdown of ACh. The ACh bound in the receptors is in equilibrium with the free Ach present in cleft between the axon terminal and the skeletal muscle fibre. Acetylcholinestrase causes the fall in concentration of free ACh by breakdown, thus less amount of ACh is there to bind with receptors. The moment the receptors do not contain bound ACh the ion channels in the end plate close. Thus causing the depolarised end plate to return to its resting potential so that it can respond the arrival of Ach which would be released by the next nerve action potential. The axon terminals are located at the centre of the muscle fibre and thus with the generation of muscle action potential the wave of excitation travels bidirectionally towards the end of the fibre. Sliding Filament Mechanism Actin is globular in structure and hence when these single polypeptide chain polymerizes with other actin molecules forms a helical structure with a myosin binding site. Hence along with tropomyosin and troponin regulatory proteins these molecules together form a thin filament (see fig.4). Myosin molecules on the other hand comprises of two golf club like structures that are facing in the opposite direction hence these club heads are called myosin cross bridges (see Fig.5). During shortening of the length these myosin cross bridges hook on to the myosin binding sites in the actin molecules and pull the thin filaments towards the M line of each sarcomere. These filaments upon overlapping form arcs around the fixed poistion of the sarcomer. The length of I bands and the H zones keeps decreasing and finally reaches the minimum during the sliding of the filaments .During contraction the length of the sarcomere depends on the movement of these molecules hence the length of the sarcomere decreases with the increase in contraction. This process of filament sliding is repeated many times to complete contraction of the muscle. The following figure (see Fig.6) shows the overlapping of the thick and thin filaments in a sarcomere. According to the sliding filament theory the muscle contraction process is due to the release of calcium ions. These ions are released by the lateral sacs in the sarcoplasmic reticulum when an action potential triggers the transverse T- tubules. Troponin and tropomyosin molecules prevent the overlapping of the actin and the myosin molecules before the release of the calcium ion. Upon release the calcium ions bind on to troponin complex to causing a shift and exposing the active site so that myosin cross bridges can be formed. Now the myosin is activated by the release of the calcium ions and breaks down in to ATP (adenosine triphosphate) ,ADP (adenosine diphosphate), inorganic element (Pi) releases energy. This energy is used by myosin heads to pull the actin myofilaments along so that these filaments slide over each other thus cross bridges break at on site and attach at the other causing the muscle to contract. The contraction cycle ends when there is no action potential propagatin g through the T-tubules. As a result of which the calcium release channels are closed and the remaining calcium ions are pumped out of the sarcoplasemic reticulum. The troponin-tropomyosin complex returns to it original position and blocks the myosin binding site on actin. Thus the cross bridge movement ceases and the muscle relaxes. The above process is explained in figure 7 which gives the sequence of operations that are involved in muscle contraction. Skeletal Muscle Disease- Muscular Dystrophy Skeletal muscle diseases are of many types which affect the normal movement and posture of the human body. This may be because of the loss of contractile properties of the muscle (myopathy) or the nervous system that is involved in contraction of the muscle (neuropathy). This disease taken into consideration here is muscular dystrophy. Muscular dystrophy is the name given to a group of genetic muscle related disorder, characterized typically by muscle fibre degeneration. Generally about 1 in 3500 boys are affected and in the UK nearly around 100 boys are born of these disease[A,C] The most common among the group of disorders is the Duchenne muscular dystrophy and the myotonic muscular dystrophy . Usually it is more common in males since the disorder is carried on the recessive sex chromosome (X chromosome). The sex chromosomes in males is made up of X and Y chromosomes, hence a disorder in anyone of the two would cause the genetic disorder to appear. However in females the sex chromosomes comprise of a pair of X chromosomes, thus a genetic disorder would not appear unless both the X chromosomes carry a disorder. The most common symptoms seen in muscular dystrophy are Scoliosis (the bending of the spine in a S pattern), inability to walk hence the balancing of the body is not proper, calf pain and improper gait. The following figure (Fig.8) shows the symptoms of muscular dystrophy. These symptoms are diagnosed by measuring the high level of a certain enzyme called creatine kinase in the blood. Some other techniques include DNA testing and muscle biopsy. According to the recent findings it was found that certain biochemicals like dystrophin, merosin and adhalin were found deficient when diagnosed for muscular dystrophy[B]. Duchenne muscular dystrophy is the most serious and the most common type of dystrophies. In this dystrophy the Xp21 position part of the X chromosome arm carries the disorder and the gene that is encoded is dystrophin,. This protein is either absent or non functional in this disease. Normally patients suffering from this disease have a life expectancy of 25 years which can improve depending on the quality of treatment received so as to reduce the development of respiratory problems which may lead eventually to death. Most of the patients die at an early age because of the car diacmyopathy. According to certain statistical studies done on the survival rate of duschenne muscular dystrphy it was found that the survival rate has increased from 14.4 years in the 1960s to 25.3 years in the 1990s but the occurrence of cardiacmyopathy has decreased the years to 16.9. Its also found that a drastic increase in percentage of survival rate from 0% in 1960s to 53% in 1990s upon good quality treatment.
Sunday, January 19, 2020
Physics of a Mountain Bike Essay example -- Physics Papers
Physics of a Mountain Bike This paper will discuss some of the physics involved in bicycles. Specifically, mountain bikes with suspension. A bicycle is a very energy efficient vehicle. Its wheels allow its rider to make full use of inertia and gravitational potential energy. The basic design of a bicycle has been around for over 100 years and compared to other things, has changed very little. Some of the topics that will be covered are: frames, wheels, suspension forks, suspension frames, brakes and how all these things affect speed, momentum and stability. Some of the key parts of any bicycle are the frame, forks and wheels. The most common type of bicycle frame is known as the double diamond. It is called this because if you look at the frame, it is diamond shaped with 2 smaller triangles forming the front and rear. This designed has endured because it is easy to build, strong and efficient. The tubing that a frame is made with is usually round but can be many different shapes even on the same bike. The reason for this shaping is to increase the rigidity or improve the ride quality. For instance, the sloping tube that goes from the front of the bike to the pedal junction of the frame is sometimes ovalized along the horizontal axis at the pedal junction to make the frame flex less side to side. Frames have been made from many materials including wood, steel, aluminum, titanium and carbon fiber just to name a few. Each of the materials have a strength to weight ratio, tensile strength and cost of production that must be taken into accou nt before deciding which will work best. For example, when a frame made of beryllium was introduced, the strength to weight ratio was very high. The weight was extremely low but the cost wa... ...etty. The faster you go, the smoother it gets and the greater the force required to stop. Mass times velocity is not fun when applied to a crash. Mike Farrentino in an article in Bike magazine says, ââ¬Å"The faster you go, the longer the crash, the greater the force of the impact. Seconds seem like hours, and the clatter and gasp and thud of cart wheeling bike and body parts is not a sound easily forgotten. â⬠¦In spite of this, whatever any of us say, we all want to go fastâ⬠¦.Momentum is the secret key to the universe. It is the rush of joy. It is the heavy hand of gravity. It is the grin of a child, feet off the pedals, bombing downhill on a tricycle.â⬠Sources Bike magazine: volume 10, number 2 March 2003 Bloomfield, Louis A : How things work, the physics of everyday life, 1997 Kirkpatrick & Wheeler: Physics, a world view, third edition, 1998 www.howstuffwork.com
Saturday, January 11, 2020
Slavery & Abuse – Modern Day Realities for Maid
ââ¬Å"At her death, the 19-year-old girl ââ¬â who was 50 kg when she arrived in Singapore ââ¬â weighed only 36 kg and had more than 200 injuries on her body. â⬠(Lee, para. 3) The evolution of domestic workers in Singapore dates back to the mui tsai, migrant girls from China in the early 1890s who were the virtual slaves of the rich families. They worked from dawn to dusk and into the wee hours of the morning. However, the number of foreign domestic workers started to grow only in the 1970s, a result perhaps of the economic boom then, and the desire for more leisure. The number continued to rise rapidly. In 2005, there were more than 140,000 foreign domestic workers in Singapore. (Chew, pg. 152) It may seem that maids working in a first world country like Singapore, has it easy off, compared to those working in second world countries, but there is a hidden claw that scars maids in this roaring Lion City. Some may say that maid abuse is not a widespread problem and that the irresponsible reporting of maid abuse by the local papers and television is the problem. On the other hand, others believe that maid abuse still remains a widespread problem. Singaporean, para. 12) Singapore maids undergo the risk of being abused due to financial and educational circumstances for their family, leaving them with psychological effects during and after abusive treatment. Foreign Domestic Workers come to Singapore in search for a job, without the protection of the Singapore government, to get them out of a poverty stricken life they have back in their hometown. The y earn money to be able to build a home and be able to afford a decent education and keep their children sufficiently fed and clothed. However, the cost of this may lead to a permanent psychological trauma caused by employers, which follows them for the rest of their lives after their contract is up, if they do not commit suicide. These abusers come from all walks of life: A school teacher had forced her maid to eat her own feces(Singaporean, para. 11), a father of two kicked and threw chairs at his maid(Singapore, para. 3), an air force staff sergeant tortured his sleep deprived maid by whipping her(Chong, para. 8), even children slap and hit their maids repeatedly to the encouragement of their parents(Rhonda, entry 5, para. ). Something has to change. Background Singapore for the past century has been a country growing in population and world status and recognition. Once an island of fishing village, and a British settlement, today Singapore is a republican country, which had undergone tremendous change. This is a result of the workforce Singapore has and its strategic location on the globe, being located off the southern tip of the Malay Peninsula, making it an ideal destination to port ship between traveling between the Indian and Pacific Ocean, thus being a highly growing and expanding nation. With a huge amount of Singaporeââ¬â¢s society holding jobs that requires long hours, they hire helpers, maids, to lighten their work load for the chores they have to do. In 2005, there were more than 140,000 foreign domestic workers in Singapore(Chew, pg. 152), under the care of employers who hire these helpers from one of the 700 maid agencies in Singapore. (Chew, pg. 152) These employers may hold high paying jobs or high posts in the company they work for, but there is always a hidden side to people. In 1997, Singapore has reported 157 cases, 89 cases in 1998, 82 cases in 1999. (Sierakowski, pg. 133) it may seem that there is a downward trend with maid abuse cases of such in Singapore, however, there was 87 cases in 2000 and it has since been rising. (Chew, pg. 133) The cases of abusive behavior implicated upon the employerââ¬â¢s helper, usually happens behind closed doors of the employers resident: be it in their HDBââ¬â¢s (government funded Housing and Development Board in Singapore), landed properties, condominiums or private properties. The implications of such abusive inflictions on their helpers, causes physiological traumas embedded forever with their helpers. Unfortunately, some of these traumas unfortunately do end with the loss of lives. Description The idea of maid abuse parallels the idea of slavery. In Singapore, there was no term known as maid abuse till the recent decade. Each year, an average of 90 maids report the abuse cases and are documented into the system, however, many goes unheard. (Chew, pg. 33) The basic ideology of maid abuse happens when a worker under the employment of an employer is ill treated to an extent that would cause side effects to a person physically and mentally. A recent case of maid abuse consisted of a maid being kicked in the belly, slapped, and thrown multiple items at her for not preparing curry puffs as instructed properly. This maid, suffered injuries to her arms and toes, but managed to flee the apartment and reported the abuse to the police. The abuser, Mat Nooh, a father of two, and teacher, was found guilty, and this particular case was settled. Singapore, para. 2) It is important to know that even a person holding a profession as a teacher, who provides an education to others, and is a highly respected job that others trust and seek information from, is able to carry out such abusive behavior towards a fellow human being. It leads us to question the fact of how much a person can appear to be what he is not, question the true identity of others. However, not all abused are able to take the physical and psychological abuse. There was another maid who is referred to as Imelda, had acquired bruises all over her body. She alleged that her employerââ¬â¢s brother had hit her repeatedly whenever he would get drunk. In January 1988, he had handed her his knife and told her to kill herself. By doing this action, the employerââ¬â¢s brother had not only physically abused the maid, but also had imprinted the underlying idea that Imelda was useless and would be better off to the world to be dead. Imelda has initially fled to Philippine Community Center, which has since been closed down, to take refuge. However the psychological impact of the matter was too much for her to take, and she had plummeted from the hospital window, to her death. (Sampang, pg. 8) This is significant to the fact that the abuse of a maid does not stop when the maid leaves the abusive environment, but the effects of it continue to linger in her subconscious mind and it would impair her judgment and thought process in the future due to the abusive acts inflicted upon the maid. Leaving a permanent psychological scar on the maid, forever. There are laws in Singapore that protect helpers, for the most part, from being hurt physically, being wrongfully confined and outraged of modesty, but, it is important to note that foreign domestic workers are not protected under the Employment Act, 1968(Chew, pg. 53), that all employees in Singapore are protected by. If you enter a foreign country to work in it as a domestic helper and you realize that the government of that country does not protect you the way it protects the other 5. 5 million people living in the same country, it results in not just fear in the back of your mind but it trips a wire that subconsciously tells you, you are not of the same value of others. Analysis A psychological effect on a person doesnââ¬â¢t require drastic measures to happen before changes in a personââ¬â¢s mind occur. Even a simple thing such as that, maids who are employed by couples are often made by the employerââ¬â¢s wife to cut their hairs short and not to wear any makeup so they will be less attractive to the employer(Perlez, para. 25), may be of mental harm towards a maid. This may not seem to be a big deal, however not being able to look good for herself, psychologically impairs the person to think that she is ugly and not worth the trouble, consequently causing a decrease of self respect , ego and insecurity in looks, with the possibly of resulting in the state of depression. In simple terms, the maid turns suicidal as a result of abuse. However, the effect of maid abuse does not stop there, but carries on as a chain reaction. If a child sees his/her parents abusing their maid when they are young, the child will think that it is the norm and would carry this trait into the future, and would abuse the possible maid he/she would employ. Abuse may not only be in the form of physical contact between the two parties, derogatory verbal statements made about these domestic helpers may also be considered as an abuse. It may not seem that verbal statements could be an abuse, however when you start referring to a person as said ââ¬Ëmaidââ¬â¢, it lowers a personââ¬â¢s self-respect and in their subconscious mind, they feel like they are being told that they are worth less than others as they have to ââ¬Ëserveââ¬â¢ their employers. However, in this seemingly dark and grim topic, there is a glimmer of hope for this matter. If we are able to raise awareness within the community, then the rate of abuse cases would decline over time, consequently saving the lives of possible future victims. Solutions H. O. M. E (Humanitarian Organization for Migration Economics), is one of the charities in Singapore that is helping out the situations of abused maids in Singapore. H. O. M. E helps these maids by offering them to be told of their rights and options in their own native tongue. In addition to that, H. O. M. E aids abused migrant workers by informing the MOM (Ministry of Manpower) of the case an d follows up onto it, be it negative or embarrassing towards the ministry. (Maid, para. 24) H. O. M. E also provides referral services, shelter, income-generating opportunities, and legal aid to abused migrant workers. It helps workers navigate the justice system in Singapore and has been cultivating a working relationship with the Ministry of Manpower and sending countries' embassies to respond to cases of abuse. (Maid, para. 54) An idea to a new solution would be to create an advertisement campaign to educate the young public. This would be the solution to the maid abuse problem. It would be to educate the young to prevent these problems in the future, as the past has already happened. The condition of maid abuse cannot be changed overnight by campaigning about it. The elder generationââ¬â¢s mindsets have already been written in stone and so it would be hard to sway their mindset. However, the younger generation is easily influenced and so by educating them on respect of other human beings regardless of their ethnicity and background, it would prove to be worthwhile, with the outcome of a new generation of people who would respect, understand and have more compassion. Even though MOM had held a photographed campaign against the abusive behavior towards maids, I felt that I could approach my campaign from a totally new and different perspective. The advertisement campaign could consist of three different compositions that mirror the layout of TIME magazine, so the viewer would be draw to see the image. The first could consist of an image of an abused maid cowering in a dark corner, accompanied with shocking text as topics. The second could consist of an image of a shadowed fist about to strike maid, accompanied with socking text as topics. The third could consist of a picture of an abused maid with a tear rolling down her cheek, portraying her cry for help. The campaign will be up on the internet alongside being posted in strategic locations around my school, for maximum exposure. This campaign could possibly have a very strong impact on the audience. However, the limitation of this would be the amount of audience that this would receive, and if they would even care. Conclusion There are many implications to the extent of abuse possible. Even in this magnificent Lion City, Singapore, there are abusive behaviors occurring to the employed helpers of households. This leaves a mental imprinted scar in he minds of such victims through and subsequent to abusive treatment. The abused will feel that they are inferior to the general public and start to decline into the start of depression, with the possibility of resulting in death. However, there are solutions to the problem at hand, by raising awareness within the community. Maids have plunged from top stories of buildings, slit their wrist, starved, beaten and abused to death. We must not let them die in vain. Each and every one of them has a story to tell. Let us carry their voices on.
Friday, January 3, 2020
How to Place a Checkbox Into a DBGrid
There are numerous ways and reasons to customize the output of a DBGrid in Delphi. One way is to add checkboxes so that the result is more visually attractive. By default, if you have a boolean field in your dataset, the DBGrid displays them as True or False depending on the value of the data field. However, it looks much better if you choose to use a true checkbox control to enable editing the fields. Create a Sample Application Start a new form in Delphi, and place a TDBGrid, TADOTable, and TADOConnection, TDataSource. Leave all the component names as they are when they were first dropped into the form (DBGrid1, ADOQuery1, AdoTable1, etc.). Use the Object Inspector to set a ConnectionString property of the ADOConnection1 component (TADOConnection) to point to the sample QuickiesContest.mdb MS Access database. Connect DBGrid1 to DataSource1, DataSource1 to ADOTable1, and finally ADOTable1 to ADOConnection1. The ADOTable1 TableName property should point to the Articles table (to make the DBGrid display the records of the Articles table). If you have set all the properties correctly, when you run the application (given that the Active property of the ADOTable1 component is True) you should see, by default, the DBGrid display the boolean fields value as True or False depending on the value of the data field. CheckBox in a DBGrid To show a checkbox inside a cell of a DBGrid, well need to make one available for us at run time. Select the Data controls page on the Component Palette and pick a TDBCheckbox. Drop one anywhere on the form - it doesnt matter where, since most of the time it will be invisible or floating over the grid. Tip: TDBCheckBox is a data-aware control that allows the user to select or deselect a single value, which is appropriate for boolean fields. Next, set its Visible property to False. Change the Color property of DBCheckBox1 to the same color as the DBGrid (so it blends in with the DBGrid) and remove the Caption. Most importantly, make sure the DBCheckBox1 is connected to the DataSource1 and to the correct field. Note that all the above DBCheckBox1s property values can be set in the forms OnCreate event like this: procedure TForm1.FormCreate(Sender: TObject);begin DBCheckBox1.DataSource : DataSource1; DBCheckBox1.DataField : Winner; DBCheckBox1.Visible : False; DBCheckBox1.Color : DBGrid1.Color; DBCheckBox1.Caption : ; //explained later in the article DBCheckBox1.ValueChecked : Yes a Winner!; DBCheckBox1.ValueUnChecked : Not this time.; end; What comes next is the most interesting part. While editing the boolean field in the DBGrid, we need to make sure the DBCheckBox1 is placed above (floating) the cell in the DBGrid displaying the boolean field. For the rest of the (non-focused) cells carrying the boolean fields (in the Winner column), we need to provide some graphical representation of the boolean value (True/False). This means you need at least two images for drawing: one for the checked state (True value) and one for the unchecked state (False value). The easiest way to accomplish this is to use the Windows API DrawFrameControl function to draw directly on the DBGrids canvas. Heres the code in the DBGrids OnDrawColumnCell event handler that occurs when the grid needs to paint a cell. procedure TForm1.DBGrid1DrawColumnCell( Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); const IsChecked : array[Boolean] of Integer (DFCS_BUTTONCHECK, DFCS_BUTTONCHECK or DFCS_CHECKED);var DrawState: Integer; DrawRect: TRect;beginif (gdFocused in State) thenbeginif (Column.Field.FieldName DBCheckBox1.DataField) thenbegin DBCheckBox1.Left : Rect.Left DBGrid1.Left 2; DBCheckBox1.Top : Rect.Top DBGrid1.top 2; DBCheckBox1.Width : Rect.Right - Rect.Left; DBCheckBox1.Height : Rect.Bottom - Rect.Top; DBCheckBox1.Visible : True; endendelsebeginif (Column.Field.FieldName DBCheckBox1.DataField) thenbegin DrawRect:Rect; InflateRect(DrawRect,-1,-1); DrawState : ISChecked[Column.Field.AsBoolean]; DBGrid1.Canvas.FillRect(Rect); DrawFrameControl(DBGrid1.Canvas.Handle, DrawRect, DFC_BUTTON, DrawState); end; end; end; To finish this step, we need to make sure DBCheckBox1 is invisible when we leave the cell: procedure TForm1.DBGrid1ColExit(Sender: TObject);beginif DBGrid1.SelectedField.FieldName DBCheckBox1.DataField then DBCheckBox1.Visible : Falseend; We need just two more events to handle. Note that when in editing mode, all keystrokes are going to the DBGrids cell, we have to make sure they are sent to the CheckBox. In the case of a CheckBox we are primarily interested in the [Tab] and the [Space] key. [Tab] should move the input focus to the next cell, and [Space] should toggle the state of the CheckBox. procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);beginif (key Chr(9)) then Exit; if (DBGrid1.SelectedField.FieldName DBCheckBox1.DataField) thenbegin DBCheckBox1.SetFocus; SendMessage(DBCheckBox1.Handle, WM_Char, word(Key), 0); end;end; It could be appropriate for the Caption of the checkbox to change as the user checks or unchecks the box. Note that the DBCheckBox has two properties (ValueChecked and ValueUnChecked) used to specify the field value represented by the checkbox when it is checked or unchecked. This ValueChecked property holds Yes, a Winner!, and ValueUnChecked equals Not this time. procedure TForm1.DBCheckBox1Click(Sender: TObject);beginif DBCheckBox1.Checked then DBCheckBox1.Caption : DBCheckBox1.ValueChecked else DBCheckBox1.Caption : DBCheckBox1.ValueUnChecked;end; Run the project and youll see the checkboxes all over the Winner fields column.
Subscribe to:
Posts (Atom)