picyka Posted July 30, 2021 Share Posted July 30, 2021 Do we have any request to get ActiveControl? Ex: I have a frame with some controls, one of them is a grid, when I give F12 (rule implemented in the frame -> UniEvents) I want to know if I'm on top of a grid Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 30, 2021 Share Posted July 30, 2021 1 hour ago, picyka said: I want to know if I'm on top of a grid Hello, Can you please explain in more detail? Quote Link to comment Share on other sites More sharing options...
picyka Posted July 30, 2021 Author Share Posted July 30, 2021 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 Quote Link to comment Share on other sites More sharing options...
picyka Posted July 30, 2021 Author Share Posted July 30, 2021 39 minutes ago, Sherzod said: Hello, Can you please explain in more detail? I'm trying a workaround here 😁 Quote Link to comment Share on other sites More sharing options...
picyka Posted July 30, 2021 Author Share Posted July 30, 2021 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.