DBLookupComboBox and Refreshing of Contents - delphi

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;

Related

Codename one list scrolled down when returning to form

I've had some testers reporting an intermittent issue on a search page that contains a list.
They say when they have been on the page and navigate to a sub page then return that the list is sometimes scrolled all the way to the bottom of the screen.
I've disabled tensile drag on the list, but I wanted to know if there was any other work-around for this issue?
This has nothing to do with tensile drag. When you navigate from one form to another in the old GUI builder the form is re-created from scratch and re-positioned based on the data.
We try to select the previously selected item but if something in the list changed this might trigger issues.
You can override restoreComponentState in the state machine with a blank implementation to see that this is the cause of this behavior. Assuming that it is you can create a special case for the list instance.

How to reload parent view in Vaadin without table reseting sort order

I'm using PagedFilterTable in Vaadin to manage pagination. When loading default page, I have set something like this - and I include sorting by some field:
if(this.sortField != null){
table.setSortContainerPropertyId(this.sortField);
table.setColumnWidth(this.sortField, 80);
table.setSortAscending(true);
table.sort();
}
So that happens when the page is loaded and that is fine. After I submit new entry (entries are being added through new, popup window), table gets new row, but the table loses it's sort order in view after popup closes, so sorting is no longer keeped. Problem is I do not know how to get to that table element from that popup window and set sorting again. Why table is being updated and I see it, and sort doesen't? Problem is bigger because I have both windows in separate files and seems to me I can't grab table element easily without modifiying the logic because I am in another window.
How to reload table so that the sort stays same?
I managed to do this after submit:
getUI().getPage().reload();
With that it works, but I am not satisfied. After that line of code, everything reloads again (meaning all queries execute again). Result is good but I don't want after submit whole reloading of page happens (also because none of my other buttons do reload). So I would like only to reload table in parent window.
How can I grab table object from outside window and for example set it's change to immediate and correct change?
Something like this I suppose needs to be written:
getParent().getUI().setImmediate(true);
?
Or better question, how to manage to table sort remains the same after inserting new entry through new window?
I managed to solve it. On the parent window in the windowCloseListener I just added:
myTable.refreshTable(data);
myTable.sortTable(); // my custom method that was Invoked on the page load too

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.

Pop up data is not clearing in Richfaces 4.0

I am new to Rich Faces and we are using richfaces 4.0. We are having an pop up requirement in our project and we used rich:popupPanel.
In the pop up we are having a form with 5 to 10 input text boxes and selectManyCheckbox components.
Whenever the user opens the pop up, fills the data and click Save, the data is being saved properly.
But when the user opens the pop up again, the already entered data is being displayed, actually it should be an empty form.
Can anyone help me on this?
Thanks in advance.
It is probably because the backing bean that supply the values to your controls in the rich:popupPanel is in the session scoped and you forget to clear these values in the action method when the save button in the rich:popupPanel is pressed.
Please check if you really clear these values in that action method

"Hello, world!" example for DevExpress QuantumGrid?

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"

Resources