Saturday, March 21, 2020

robinsin crusoe essays

robinsin crusoe essays Robinson Crusoe is an imaginary story about a merchant-adventure marooned on a desert island off the northern coast of South America. Daniel Defoe wrote this novel in 1719.He based the story partly on the experiences of a Scottish sailor, Alexander Selkirk, but defoe's realistic account of Crusoe's like is much more interesting, and has become one of the most popular books in English. The book explains how Crusoe cleverly manages to make himself at home while he lives on the island. From my point of view the unique part that connects at this point in the story is that after living alone for 26 years, Crusoe rescues a man from cannibals. He calls the man Friday because he met him on that day. Friday becomes Crusoe's trusted friend and servant. The term, "man Friday" has come to mean any trusted servant. Finally after 28 years, Crusoe and Friday board a passing ship and are taken to England. "Robinson Crusoe" is a lively, exciting book that sweep the reader away in to amazing world. Although the English of the book is "old fashion", I recommend it from the bottom of my heart! A Close: (fill out the blanks with one or two words) Robinson Crusoe has always been one of the popular novels in the English language. I believe that the to the fact above is that Robinson Crusoe is one of the realistic novels that were ever published. During the novel plot develops, describes events and scenes in great detail and them seem very alive. The fate of has held a special fascination for me. As I watch Crusoe struggle to survive alone on a Island , I pot myself in his place and wonder how long I would have lived in such harsh . Could I, like Crusoe, have begun to build anew life for myself? Or would hunger and the terrible loneliness have destroyed a ...

Thursday, March 5, 2020

Create a Mouseover Color Highlight Using Delphi

Create a Mouseover Color Highlight Using Delphi Have you ever seen a menu or table column or row highlight to a different color when your mouse hovers over it? Thats what our goal is here: to have a row become highlighted when the mouse pointer is within range. The TDBGrid Delphi component is one of the jewels of the VCL. Designed to enable a user to view and edit data in a tabular grid, the DBGrid provides various ways of customizing the way it represents its own data. For example, adding color to your database grids will enhance the appearance and differentiate the importance of certain rows or columns within the database. However, dont be fooled by over-simplistic tutorials on this topic. It might seem easy enough to just set the dgRowSelect property, but remember that when dgRowSelect is included in Options, the dgEditing flag is ignored, meaning that editing the data using the grid is disabled. What youll find below is an explanation on how to enable the OnMouseOver type of event for a DBGrid row, so that the mouse is recorded and located, making the record active so as to highlight the corresponding row in a DBGrid. How to Work With OnMouseOver and Delphi Components The first order of business is writing code for the OnMouseMove event in a TDBGrid component so that it can locate the DBGrids row and column (cell) that the mouse is hovering over. If the mouse is over the grid (handled in the OnMouseMove event handler), you can use the MoveBy method of a DataSet component to set the current record to the one displayed below the mouse cursor. type THackDBGrid class(TDBGrid);...procedure TForm1.DBGrid1MouseMove (Sender: TObject; Shift: TShiftState; X, Y: Integer);var gc: TGridCoord;begin gc: DBGrid1.MouseCoord(x, y); if (gc.X 0) AND (gc.Y 0) thenbegin DBGrid1.DataSource.DataSet.MoveBy (gc.Y - THackDBGrid(DBGrid1).Row); end;end; Similar code can be used to show which cell the mouse hovers over and to change the cursor when its over the title bar. In order to correctly set the active record, you need to hack a DBGrid and get your hands on the protected Row property. The Row property of a TCustomDBGrid component holds the reference to the currently active row. Many Delphi components have useful properties and methods that are marked invisible, or protected, to a Delphi developer. Hopefully, to access such protected members of a component, a simple technique called the protected hack can be used. With the code above, when you move the mouse over the grid, the selected record is the one displayed in the grid below the mouse cursor. Theres no need to click the grid to change the current record. Have the active row highlighted to enhance the users experience: procedure TForm1.DBGrid1DrawColumnCell (Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);beginif (THackDBGrid(DBGrid1).DataLink.ActiveRecord 1 THackDBGrid(DBGrid1).Row) or (gdFocused in State) or (gdSelected in State) thenbegin DBGrid1.Canvas.Brush.Color : clSkyBlue; DBGrid1.Canvas.Font.Style : DBGrid1.Canvas.Font.Style [fsBold]; DBGrid1.Canvas.Font.Color : clRed; end;end; The OnDrawColumnCell event is used to handle the need for a customized drawing for the data in the cells of the grid. You can use a little trick to differentiate the selected row from all the other rows. Consider that the Row property (integer) is equal to the ActiveRecord (1) property of the DataLink object that the selected row is about to be painted. Youll probably want to disable this behavior (the MoveBy method in OnMouseMove event handler) when DataSet connected to a DBGrid is in Edit or Insert mode.​