Ticket DQ43855
Visible to All Users

I would like to get FieldName from FocusedRow

created 18 years ago

I would like to get FocusedField as I could do it in TdxDBInspector. I do it like this:
      AControl := Screen.ActiveControl;
      if (AControl is TdxDbInspector) and TdxDbInspector(AControl).IsActive and
        (TdxDbInspector(AControl).FocusedField.FieldKind = fkData)
      then
         ShowFieldInfo(TdxDbInspector(AControl).FocusedField);
ShowFieldInfo is my procedure that show field properties.

Comments (3)
DevExpress Support Team 18 years ago

    Hi!
    Thank you for the message. The peculiarity of processing CX editors via the ActiveControl is described in our knowledge base article "How to obtain the CX editor corresponding to the ActiveControl property" at http://www.devexpress.com/kbA1102. As for your task, you can verify whether the vertical grid inplace editor is actived and process its FocusedRow as follows.

    var
      ACustomRow: TcxCustomRow;
    begin
    if (ActiveControl is TcxCustomInnerTextEdit) and (ActiveControl.Parent.Parent is TcxDBVerticalGrid) then
      begin
         ACustomRow := TcxDBVerticalGrid(ActiveControl.Parent.Parent).FocusedRow;
         AFieldName := TcxDBEditorRow(ACustomRow).Properties.DataBinding.FieldName;
      end;
    end;
    Thanks,
    Nicolas.

      This will not work with MultiEditor row. Can you please provide code for it.
      Thank you !

      DevExpress Support Team 18 years ago

        Hi!
        You can try to type cast the obtained ACustomRow to the TcxMultiEditorRow class object:
        var
          ACustomRow: TcxCustomRow;
          AType: String;
        begin
        if (ActiveControl is TcxCustomInnerTextEdit) and (ActiveControl.Parent.Parent is TcxVerticalGrid) then
          begin
             ACustomRow := TcxVerticalGrid(ActiveControl.Parent.Parent).FocusedRow;
             if ACustomRow is TcxMultiEditorRow then
             begin
                AType := TcxMultiEditorRow(ACustomRow).Properties.Editors[<AIndex>].DataBinding.ValueType;
             end;
          end;
        end;
        I hope this will help you.
        Thanks,
        Nicolas.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.