Delphi2007 + TWWDB grid field conversion - delphi

I am using delphi 2007.
I want to show the user defined value for one of the TWWDBgrid** field.
For eg: I want to show GENERAL in the DB grid for the database value 1
Can anybody help?

You could imbed a TwwDBComboBox into the TwwDBGrid within its ControlType property.
Drop a TwwDBCombo onto the same form as the Twwdbgrid. Select the Items property which will initially show "<0 Items>" (ignore the 3 Items shown in the image - I got lazy!).
Check the "Map Displayed Value to Stored Value". This is most important as it displays the grid. Add the values as shown. You only mention one value but maybe there are more values than just '1' on the database.
Then select the ControlType property of your TwwDBGrid.
Select the relevant database field from the list (I have not included the image), select the "Edit Control" tab, select "CustomEdit" from the "Control Type" drop down and in "Control Name", select the TwwDBCombo control you created above.
This approach will allow the user to change the field value using a drop down. If you don't want the user to change the value, then just check the Read-Only property of the DBCombo.

Related

IBM BPM: Is it possible to hide a column of a table dynamically based on user choice?

Since I'm new to this technology (Coach UI) I wanted to know an information, is it possible to delete a column based on the user's choice?
That is, I have a modal that contains the column fields and if I choose to hide a column it hides it dynamically.
Thank you in advance for the reply, I have been on this problem for 2 days :(
Configurations of Controls in BPM can be either provided with values or bound to a variable.
Binding configuration item to a variable will give you the ability to change it dynamically, by changing the value of that variable.
For your request, you can click on the purple icon next to Columns (image bellow) to switch to binding mode, then select a varible of type TableColumn (This BO is available in the UI Toolkit itself, open the BO to check the documentation).

ComboBox with hidden keys

Is it possible in vaadin 12 to have comboboxes such that it displays a user-friendly value but behind the scenes it stores a hidden code? I found this example from 5 years ago but it doesn't apply to Vaadin 12 comboboxes: https://vaadin.com/forum/thread/7821327/combo-box-hidden-values
(If there's a good, reasonably clean way to do it, please point me in the right direction! I would think this is a common sought-after feature)
Items are assigned to ComboBox either directly using setItems or indirectly through setDataProvider.
The item itself is not sent to the browser and shown in the dropdown. Instead, for each item ComboBox generates a string label that is shown in the UI and an internal id that is used on the server for mapping back to the original item instance when the user makes a selection.
The generated id is internal to ComboBox and has no external meaning. In particular, it's not based on any value in the item itself such as the item's primary key in the application's database.
The label is by default based on doing toString() for each item. You can customize how the label is created by assigning an item label generator callback that receives an item instance and returns the label string to use for that item.
If you for example have a combo box for selecting persons, then you could configure it in e.g. this way:
ComboBox<Person> personSelector = new ComboBox<>();
personSelector.setItems(allPersons);
personSelector.setItemLabelGenerator(person ->
person.getFirstName() + " " + person.getLastName());
If I understand you correctly, there is built-in feature in ComboBox for this, the method is called setItemLabelGenerator(..), which allows to define e.g. lambda expression that returns String which is used for ComboBox items instead of the property from underlying data object.
The linked Forum discussion you found is about similar thing in our previous generation of the framework, there has been some renaming of the API here.

Delphi TDBGrid edit inplace with drop down list

I have to do maintenance to an old Delphi v7 application which uses a TDBGrid allowing inplace editting with drop down lists.
The issue is: the grid will show only the values present at data source. Without editting, this would be no problem at all. But if I change some value, the grid will only show the newly set value after updating the underlying register (until that the "old" value is displayed).
This only applies to drop down lists. Other input types (checkboxes, text edits) work without problems.
The edit itself also works fine: the changed values are actually reflected in the datasource when the register is UPDATE'd. My only problem is displaying this not-yet-UPDATE'd value.
I have no idea how to even debug this, or further inspect this behavior. So even if you don't have a complete answer, please indicate what else can I do to find a solution.
UPDATE
The project originally used TDB3DGrid (whose source I'm not aware of), but to simplify things I've changed it to TDBGrid. To no avail. The only change was that true/false columns are now displayed as text, and edited as text boxes (displaying and accepting "True" and "False" strings); with TDB3DGrid it showed checkboxes.
Other columns (not edited trough drop down list) are fine: after editing the new value is displayed correctly even before updating the underlying register.
I'm still tracking down where does the list of alternatives that fill the drop down list comes from.
Also still trying to come with an MCVE.
UPDATE 2
Apparently the (now) TDBGrid's affected TDBGridColumn has an empty PickList property. Sure for designtime. But I think this is not changed in runtime.
TDBGrid's source is a child of a TQuery, whose affected field has FieldKind equal to fkLookup. Other properties set for the field are FieldName, KeyFields, LookupDataSet, LookupKeyFields and LookupResultField.

How to fill a field depending on another control field in Orbeon

How can I have a field control2 which depends on another field control1? That is, when I fill control1, control2 gets filled with the same value.
If you want 'control2' to have the same value as 'control1', you should go to the control settings of 'control2' under the Formulas tab and write the following in the Calculated Value field:
$control1
Take a look at this section of the wiki for further information

How to add a non-bound column to a DevExpress DB QuantumGrid

I am using these components:
UniDac for connection to mysql database
DevExpress for QuantumGrid
IDE:
Embarcadero Rad Studio XE2
I have a cxGrid component with one level and a cxGrid1DBTableView specified as the level's View. I can get data from my database and edit it in the grid. I want to add a column that is not in the bound DataSet. When I specify the Column properties value as CheckBox I can see the column but I can't change the value from unchecked to checked by clicking it. The field doesn't have a DataBinding assigned to it. I tried other types of Properties but all are the same I cant change the row value in the grid.
I've been searching for a way to fix this for couple of days, so im hoping you guys can help me.
Are you trying to add a checkbox item that does not have a database field behind it? I have this on one of my forms.
In addition to setting the Properties to "Checkbox" you need to set the DataBinding -> ValueType to "Boolean". The DataBinding->FieldName can be left blank.
To access the values or change their defaults you can use the DataController like this:
View.DataController.Values[i, CheckBoxFieldIndex] := true;
In addition you need to set
DataController.DataModeController.SmartRefresh := true;
To set that option you will also need a KeyField defined for the Controller (DataController.KeyFieldNames)
Setting the SmartRefresh to true will prevent the grid from trying to get an updated value from the underlying dataset. You need to prevent the refresh or the value for the non-bound column will be set back to Null. This comes with some restriction on how you update your dataset. Any changes made to the data in code will not be reflected by the grid unless you explicitly refresh the grid.
You also have to fill the field View.DataController.KeyFieldNames with one of the datasets fields. At least I need it in Delphi 7.

Resources