Tuesday, March 31, 2020

Append Formatted Lines Using SelText and SelStart

Append Formatted Lines Using SelText and SelStart The TRichEdit Delphi control is a wrapper for a Windows rich text edit control. You can use a Rich Edit control to display and edit RTF files. While you can create nice user interface around the Rich Edit control with toolbar buttons to set and change text display attributes, adding formatted lines to Rich Edit programmatically is fairly cumbersome - as you will see. How to Add Formatted Lines to Rich Edit To create bold text from a selection of text displayed in the Rich Edit control, at runtime, you need to make a section of text and then set the selections properties to SelAttributes. However, what if youre not dealing with a selection of text and instead want to add (append) formatted text to a Rich Edit control? You might think Lines property can be used to add bold or colored text to Rich Edit. However, Lines is a simple TStrings and will accept only plain, unformatted text. Dont give up - of course, theres a solution. Look at this example for some help: //richEdit1 of type TRichEdit with richEdit1 do begin //move caret to end SelStart : GetTextLen; //add one unformatted line SelText : This is the first line #13#10; //add some normal font text SelText : Formatted lines in RichEdit #13#10; //bigger text SelAttributes.Size : 13; //add bold red SelAttributes.Style : [fsBold]; SelAttributes.Color : clRed; SelText : About; //only bold SelAttributes.Color : clWindowText; SelText : Delphi ; //add italic blue SelAttributes.Style : [fsItalic]; SelAttributes.Color : clBlue; SelText : Programming; //new line SelText : #13#10; //add normal again SelAttributes.Size : 8; SelAttributes.Color : clGreen; SelText : think of AddFormattedLine custom procedure...; end; To start, move the caret to the end of the text in the Rich Edit. Then, apply formatting before you actually append the new text.

Saturday, March 7, 2020

cuba and embargo essays

cuba and embargo essays The island nation of Cuba, located just ninety miles off the coast of Florida, is home to 11 million people and has one of the few remaining communist regimes in the world. Cubas leader, Fidel Castro, came to power in 1959 and immediately instituted a communist program of sweeping economic and social changes. Castro allied his government with the Soviet Union and seized and nationalized billions of dollars of American property. U.S. relations with Cuba have been strained ever since. A trade embargo against Cuba that was imposed in 1960 is still in place today. Despite severe economic suffering and increasing isolation from the world community, Castro remains committed to communism. (Close Up Foundation) The United States and Cuba share a long history of mutual mistrust and suspicion. All aspects of U.S. policy with Cuba, such as the current trade embargo, immigration practices, and most recently the possibility of a free exchange by members of the media, provoke heated debates across the United States. While most Americans agree that the ultimate goals should be to encourage Castros resignation and promote a smooth transition to democracy, experts disagree about how the U.S. government should accomplish these aims. Some believe that the countrys current policy toward Cuba is outdated in its Cold War approach and needs to be reconstructed. However, many still consider Fidel Castro a threat in the hemisphere and a menace to his own people and favor tightening the screws on his regime even more. (Close Up Foundation) For almost forty years, the United States has not imported any Cuban products, nor allowed any American food, medical supplies, or capital to enter Cuba. President Clinton, like each of his predecessors, supports the trade embargo. Two recent pieces of legislation have tightened the economic restrictions on Cuba. (Close Up Foundation) The Cuban Democracy Act, passed by Congress in 1992...