Jump to content

ActiveControl


picyka

Recommended Posts

29 minutes ago, Sherzod said:

Hello, 

Can you please explain in more detail? 

I have a rule implemented in a parent frame.

 

if EventName = '_F10' then
    Self.btnConfirma.Click
  else
  if EventName = '_ESC' then
    Self.btnVoltar.Click
  else
  if EventName = '_F12' then
  begin
    if not Self.GetUser.Admin then Exit;

    if ActiveControl is TUniDBGrid then
    begin
      Self.Tag := 0;
      with TUniFormConfigGrid.Create(UniApplication) do
      begin
        Caption := Caption + ' (' + Copy(Self.ClassName,2,MaxInt) + ')';
        ShowForm(Self.ClassName, Self.FController.GetClient, Self.GetUser);
        Free;
      end;
    end
    else
    begin
      with TUniFormConfigTela.Create(UniApplication) do
      begin
        Caption := Caption + ' (' + Copy(Self.ClassName,2,MaxInt) + ')';
        ShowForm(Self.ClassName, Self.GetClient, Self.GetUser);
        Free;
      end;
    end;
  end;

when it's _F12, I need to know if I'm on top of a TUniDBGrid

Link to comment
Share on other sites

14 minutes ago, picyka said:

I'm trying a workaround here 😁

class procedure TConfigForm._UniDBGridKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = VK_F12 then
    TUniDBGrid(Sender).OwnerWebForm.Tag := 99;
end;


procedure TUniFrameGerDadosPadrao.UniFrameAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);
begin
  if EventName = '_F10' then
    Self.btnConfirma.Click
  else
  if EventName = '_ESC' then
    Self.btnVoltar.Click
  else
  if EventName = '_F12' then
  begin
    if not Self.GetUser.Admin then Exit;

    if Self.OwnerWebForm.Tag = 99 then
    begin
      Self.OwnerWebForm.Tag := 0;
      with TUniFormConfigGrid.Create(UniApplication) do
      begin
        Caption := Caption + ' (' + Copy(Self.ClassName,2,MaxInt) + ')';
        ShowForm(Self.ClassName, Self.GetClient, Self.GetUser);
        Free;
      end;
    end
    else
    begin
      with TUniFormConfigTela.Create(UniApplication) do
      begin
        Caption := Caption + ' (' + Copy(Self.ClassName,2,MaxInt) + ')';
        ShowForm(Self.ClassName, Self.GetClient, Self.GetUser);
        Free;
      end;
    end;
  end;
end;

OwnerWebForm can I use it?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...