Jump to content

Recommended Posts

Posted

hello 1 have a runtime created ,

how to popup top position is on newbtn top and newbtn left , coz , the monitor resolution on client is difrent 

Quote

 

  NewCol := TUniDBGridColumn(AGRID.Columns.Add);

    NewCol.ActionColumn.Enabled := true;
    NewCol.Title.Caption := '#';
    NewCol.Title.Alignment := taCenter;

    
    NewCol.Width := 15;
    NewCol.Flex := 0;


    NewBtn := TUniGridActionButton(NewCol.ActionColumn.Buttons.Add);
    NewBtn.Width := 15;
    NewBtn.ButtonId := 100;
    NewBtn.IconCls := 'fa fa-ellipsis-v fa-center-action';
    NewBtn.Hint:='Action Menu';

    AGRID.OnColumnActionClick := PlayWithGrid.GlobalActionButtonClick;

 

and the function globalactionmenu is 


 

Quote

 

class procedure PlayWithGrid.GlobalActionButtonClick(Column: TUniDBGridColumn;
  ButtonId: Integer);
var
  Grid: tunidbgrid;
  Frm: Tuniform;
  Popup: TuniPopupMenu;
  MI: TUniMenuItem;
  i: Integer;
begin

  // tombol ...
  if ButtonId <> 100 then
    exit;

  Grid := tunidbgrid(Column.Grid);

  Frm := Tuniform(GetParentForm(Grid));

  if Frm = nil then
    exit;

  Popup := TuniPopupMenu(Frm.FindComponent('UniPopupMenu1'));
  for i := 0 to Popup.Items.Count - 1 do
  begin
    if SameText(Popup.Items[i].Caption, 'Tambah') then
    begin
     if Popup.Items[i].Visible = true then
      Popup.Items[i].Visible := false;
    end;
    if SameText(Popup.Items[i].Caption, 'Refresh') then
    begin
         if Popup.Items[i].Visible = true then
      Popup.Items[i].Visible := false;
    end;
    if SameText(Popup.Items[i].Caption, 'Export') then
    begin
         if Popup.Items[i].Visible = true then
      Popup.Items[i].Visible := false;

    end;
  end;
  // MI := Popup.FindComponent('ambah1') as TUniMenuItem;

  // if MI <> nil then
  // MI.Visible := False;

  if Popup <> nil then
  begin
    Popup.Popup(Mouse.CursorPos.x, Mouse.CursorPos.y - 170);
    // Popup.PopupAtCursor;
  end;

end;

 

 

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...