Dynamically changing TwwRecordViewItem properties in TwwRecordViewPanel
Using FP 15.0.2.1 and Delphi 12.2.
I want to change the title on a label for one record view item and set the visibility for another. I coded the OnDataChange event of the TDataSource in the TBindSourceDB to set the item properties.
The issue is when the user creates a new record and changes the value of the field which toggles the others, the items do not update. I tried calling the panel's Repaint, RefreshControls (AV error), and RealignContent to force the panel to update labels and controls. No luck. Calling Changed(true) for the item does nothing either.
The record view panel is on a frame which is docked into a layout on the main form.
What is the best path to set the label text and visibility of one record item based on the value the user sets in another?
-
Sorry, I don't think we ever answered this question. The recordviewpanel has its controls created so if you are just changing the item's property it would not have any effect. I would think calling RefreshControls(true) should recreate the controls, but you say you are getting an access violation. I would need more info on how to reproduce your error with RefreshControls to follow up.
If you really need access to the label associated with the control, you can use a cheating cast to gain access to the label.
type THackRecordViewItem = class(TwwRecordViewItem);
procedure TRecordViewDemoForm.infoButtonClick(Sender: TObject);
begin
THackRecordViewItem(wwrecordviewpanel1.items['Customer No']).LabelControl.text:= 'abc';end;
Please sign in to leave a comment.
Comments
1 comment