Wednesday, March 18, 2020

Race in Mark Twains Puddnhead Wilson essays

Race in Mark Twains Puddnhead Wilson essays Mark Twains novel Puddnhead Wilson is a controversial commentary on race, identity and social determination. The action of the novel takes place in a small town in Missouri, called Dawsons Landing, in a society in which the relationship between the white people and the black was still a master-slave relationship. The text tells the story of two boys who are exchanged soon after their birth by Roxana, a slave of Percy Driscoll. The changelings exchange thus more than their names, which are Thomas a Beckett and Valet de Chambers, respectively. They exchange their race, their identity, their social position and even their lives. In an almost Shakespearian vein, Mark Twain joggles with the notion of mistaken or stolen identity. There is a particular emphasis in the text on clothes, veiling and face painting, all of which serve as masks and disguises. The two central characters in this maze of plots are Roxana and the lawyer Wilson, who plays the role of a detective and who eventually unr avels the mystery of the two twins. Roxana is a slave with only one sixteenth black blood and the rest white. The central figure of the novel, Roxy stands out as a very interesting and contradictory character. Attempting so save her son from being sold down the river, she switches the two babies that were born the same day, soon after their birth. Roxana is thus more than an overzealous mother, who is trying to protect her child at all costs. Her desperate act makes of her a modern character: by switching the two children, Roxana frees identity from its racial and social determination. Thus, her main role in the novel is to prove that identity is not dictated by the racial origin, but by the social environment in which a certain person lives. The core problem of the novel is thus the attempt to give a definition of identity, in the context of racial difference. From the beginning, identity is introduced in the novel as someth...

Monday, March 2, 2020

Drop Down List Inside a DBGrid

Drop Down List Inside a DBGrid Heres how to place a drop-down pick list into a DBGrid. Create visually more attractive user interfaces for editing lookup fields inside a DBGrid - using the PickList property of a DBGrid column. Now, that you know what are  lookup fields, and what are the options of displaying a lookup field in Delphis DBGrid, its time to see how to use the PickList property of a DGBrid column to enable a user to pick a value for a lookup field from a drop-down list box. A Quick Info on DBGrid Columns Property A DBGrid control has a Columns property - a collection of TColumn objects representing all of the columns in a grid control. Columns can be set at design time through the Columns editor, or programmatically at runtime. Youll usually add Columns to a DBGird when you want to define how a column appears, how the data in the column is displayed and to access the properties, events, and methods of TDBGridColumns at runtime. A customized grid enables you to configure multiple columns to present different views of the same dataset (different column orders, different field choices, and different column colors and fonts, for example). Now, each Column in a grid is linked to a field from a dataset displayed in the grid. Whats more, each column has a PickList property. The PickList property lists values that the user can select for the columns linked field value. Filling the PickList What you will learn here is how to fill that String List with values from another dataset at run time.Recall, that we are editing the Articles table and that a Subject field can only accept values from the Subjects table: the ideal situation for the PickList! Heres how to set up the PickList property. First, we add a call to the SetupGridPickList procedure in the Forms OnCreate event handler. procedure TForm1.FormCreate(Sender: TObject);begin SetupGridPickList(Subject, SELECT Name FROM Subjects);end; The easiest way to create the SetupGridPickList procedure is to go to the private part of the form declaration, add the declaration there and hit the CTRL SHIFT C key combination - Delphis  code completion  will do the rest: ...type TForm1 class(TForm)... privateprocedure SetupGridPickList( const FieldName : string; const sql : string); public... Note: the SetupGridPickList procedure takes two parameters. The first parameter, FieldName, is the name of the field we want to act like a lookup field; the second parameter, SQL, is the SQL expression we use to populate the PickList with possible values - in general, the SQL expression should return a dataset with only one field. Heres how the SetupGridPickList looks like: procedure TForm1.SetupGridPickList(const FieldName, sql: string);var slPickList:TStringList; Query : TADOQuery; i : integer;begin slPickList:TStringList.Create; Query : TADOQuery.Create(self); try Query.Connection : ADOConnection1; Query.SQL.Text : sql; Query.Open; //Fill the string listwhile not Query.EOF dobegin slPickList.Add(Query.Fields[0].AsString); Query.Next; end; //while //place the list it the correct columnfor i:0 to DBGrid1.Columns.Count-1 do if DBGrid1.Columns[i].FieldName FieldName thenbegin DBGrid1.Columns[i].PickList:slPickList; Break; end; finally slPickList.Free; Query.Free; end; end; (*SetupGridPickList*) Thats it. Now, when you click the Subject column (to enter into edit mode). Note 1: by default, the drop-down list displays 7 values. You can change the length of this list by setting the DropDownRows property. Note 2: nothing stops you from filling up the PickList from a list of values not coming from a database table. If, for example, you have a field that only accepts weekday names (Monday, ..., Sunday) you can build a hard-coded PickList. Uh, I need to click the PickList 4 times... Note that when you want to edit the field displaying a drop-down list, youll need to click the cell 4 times in order to actually pick a value from a list. The next code snippet, added to the DBGrids OnCellClick event handler, mimics a hit to the F2 key followed by Alt DownArrow. procedure TForm1.DBGrid1CellClick(Column: TColumn);begin//Making the drop-down pick list appear fasterif Column.PickList.Count 0 thenbegin keybd_event(VK_F2,0,0,0); keybd_event(VK_F2,0,KEYEVENTF_KEYUP,0); keybd_event(VK_MENU,0,0,0); keybd_event(VK_DOWN,0,0,0); keybd_event(VK_DOWN,0,KEYEVENTF_KEYUP,0); keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0); end;end;