"Hello, world!" example for DevExpress QuantumGrid? - delphi

I successfully installed the latest QuantumGrid from DevExpress, but I've never worked with this grid before, and I don't know how to get started. I find that the HLP file isn't really a tutorial, and the demos are so rich to the point where I can't get started quickly and see if QuantumGrid fits my needs.
Would someone happen to have a really basic example on how to create a small, non-DB-bound, non-hierarchized, but user-editable grid to host a couple of columns and fill the grid with a few rows?
Thank you.

Place a grid on a form, then delete its default GridView and add a TableView. Add a few columns to TableView and then associate your GridLevel with this new view. Place a button on form and add this code to its click handler.
cxGrid1TableView1.DataController.BeginFullUpdate;
try
cxGrid1TableView1.DataController.RecordCount := 3;
cxGrid1TableView1.DataController.SetValue(0,0,'Data1');
cxGrid1TableView1.DataController.SetValue(1,0,'Data2');
cxGrid1TableView1.DataController.SetValue(2,0,'Data3');
finally
cxGrid1TableView1.DataController.EndFullUpdate;
end;
RecordIndex corresponds to the row index and ItemIndex corresponds to the column index. I hope this helps you to get started.

Create a table
view(gridlevel->create view->table)
Create columns(double click cxgrid
and add)
Set property(inner controls like
DateEdit) if you want. default
property is textedit)
You can insert/delete via
TableView.DataController.Insert/TableView.DataController.Delete*
or use navigator(View->OptionsView->Navigator)
You should look at demos("quantumgrid directory"\Demos\Delphi), demos are more helpful than help files :)

Thanks guys for the help. For those interested in getting started with this grid object, here (what I think) are the steps presented above:
(idursun)
Add a TcxGrid object to the form
In the Structure object in the IDE, right-click on cxGrid1, and select "Delete View"
Right-click on cxGrid1, and select "Editor"
Click on the "Views" tab, click on "Add View...", and select "Table" in the drop-down list
In the "Columns" tab on the right, click on "Add", and add a few columns
Still in this dialog box, go back to the "Structure" tab on the left
Right-click on cxGridLevel1, and choose "Select View" to associate the Level with this new TableView. Close the dialog
In the form, add a button, and paste this code to its Click event:
cxGrid1TableView1.DataController.BeginFullUpdate;
try
cxGrid1TableView1.DataController.RecordCount := 3;
cxGrid1TableView1.DataController.SetValue(0,0,'Data1');
cxGrid1TableView1.DataController.SetValue(1,0,'Data2');
cxGrid1TableView1.DataController.SetValue(2,0,'Data3');
finally
cxGrid1TableView1.DataController.EndFullUpdate;
end;
(barism)
Add a TxGrid object to the form
Within this new cxGrid1 object in the form, right-click its cxGrid1Level object, and select "Create View > Table"
In the Structure object in the IDE, right-click on cxGrid1, and select "Editor..."
In the Columns tab on the right, click on Add to add a couple of columns. Close this dialog
To add data to the grid, either write code, or right-click on cxGrid1 and select "Edit Layout and Data"

Related

Style a firemonkey combobox component

Trying to get a new style on a ComboBox in FireMonkey (XE2).
But for some odd reason I cannot get the text of a ListBoxItem to show.
What I've tried is the following.
Create a new FireMonkey HD Application.
On the form I've added a ComboBox.
Right click on the ComboBox and select 'Edit custom style'
There I've added the following components
while the original one consist out of the following components
Now it seems to me that I need the TContent object (but I can't seem to find it in the toolpallete)
How can i bind my Text object to the strings that are placed in my ComboBox?
Any pointers are very welcome.
FireMonkey doesn't use a TText object to display the text. Instead it creates a copy of the list box item within the TContent (if I remember correctly).
As you've worked out you need to add a TContent to your form. The easy way to do this is to
go back to the form,
right click and select View as Text
Find the TStyleBook object and add a TContent at the appropriate point (the format for this should be obvious from the rest of the file).
No need to add any properties - defaults will be used the first time.
Right click, View as Form.
Go back into the style editor and edit away.

Bring Control to Front when Selected in the Structure Pane

I would like to build a Wizard component, where I can guid the user through different pages. When the last page is reached, an action is performed.
That component should work similar as the TPageControl, where I can create sheets at design-time. Creating that 'sheets' is already done, but my problem is, that the last added sheet is always on top of the other sheets, and I cannot select another one anymore (which are behind). In the TPageControl component, I can select a sheet in the Structure Pane, and it comes to the front, where can I put controls on it.
And this is my question: How can I bring a control (my wizard sheet) to the front, when it is selected in the Structre Pane?
I have to override the TWinControl.ShowControl function. That function is fired when you click in the structure pane on the child control. Then, I just need to invoke the BringToFront function of that child.

How to create a rails drop down menu which triggers either a text area or an upload form

I would like to create a rails drop down menu, with two options: "Upload file" and "Write text". When "Upload file" is selected, an upload form will appear on the right hand site. When "Write text" is selected, an text area appears instead.
Thanks a lot!
Well there are many ways you could go about this, but I would just display the view as normal (but hide one of the elements to begin with) and attach a jquery event to the drop down menu. You can then show/hide the element within the event handler based on the value selected. Take a look at http://api.jquery.com/change/, http://api.jquery.com/hide/ and http://api.jquery.com/show/ to get started.

DBLookupComboBox and Refreshing of Contents

I have Delphi 7 and I'm using NexusDB for the database.
I have a main form where I have a DBLookupComboBox to list the contents of a Table.
If I press a button I have on the form to add a new item to the list (which opens a 2nd dialog box) and then come back to the main form I want the newly added item to show up immediately
I can't seem to get that to work.
I've tried refreshing the DataSet under the ListSource object.
Anyone have any ideas?
Thanks,
David
DBLookupComboBox1.ListSource.DataSet.Close;
DBLookupComboBox1.ListSource.DataSet.Open;

How can I change a main menu First level caption?

I have a main menu in an MDI parent form, and it as a main menu.
Now I need to change the first level caption of my first menu item in runtime. How can I do that?
--- Update ---
Sorry. I forgot to tell you that the mainMenu is housed in a TcontrolBar.
I think that is the problem because all answer so far don’t work. I had tried all that before.
But this only occurs for the first level, all other levels change correctly.
Perhaps I'm missing something, but it seems to be very simple:
MainMenu1.Items[0].Caption := '&Hello'; // first top-level item
MainMenu1.Items[1].Caption := '&World'; // second top-level item, etc.
In the Menu Editor (at design time in the IDE), click on the menu you want to change, open the property inspector and change the name to something relevant, i.e MyFirstMenu.
Then in your code, whenever you want to change the menu items caption you can use:
MyFirstMenu.Caption := 'A New Caption';
or if the Main Menu is built dynamically see the answer TOndrej gave above.
[Edit1]
Do you mean you can set the caption successfully on the menu item but do not see the change on the TControlBar?
If you are using the old technique of adding a TToolbar inside of a TControlBar, then adding a tool button for each top menu item, then what you see in the form as top level menu items are actually the tool buttons. Set their caption directly, and everything should work.

Resources