Jump to content

Layout UniDbGrid


Muhammad Idris

Recommended Posts

On 1/16/2023 at 12:53 PM, Muhammad Idris said:

it looks like this

image.thumb.png.892ea374861223ad6446062f7119bad8.png

procedure SetFormSize (SelForm : TUniForm);
var
ClientWidth,
ClientHeight    : Integer;
begin
Try
SelForm.SuspendLayouts;
SelForm.Left := 0;
SelForm.Top := 0;

ClientWidth := UniSession.UniApplication.ScreenWidth;
ClientHeight := UniSession.UniApplication.ScreenHeight;

SelForm.Width := ClientWidth;
SelForm.Height := ClientHeight;

if (uniMainModule.AppPlatform <> [upDesktop])
then begin
    SelForm.WindowState := wsNormal;
    SelForm.Left := 0;
    SelForm.Top := 0;
    //get screen size of device
    ClientWidth := UniSession.UniApplication.ScreenWidth;
    ClientHeight := UniSession.UniApplication.ScreenHeight;

    if UniSession.FormsList.Count <= 1 then exit;

    //get size of biger form
    if (ClientWidth < FormMinWidth) then
       ClientWidth := TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Width;
    if (ClientHeight < FormMinHeight) then
       ClientHeight := TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Height;

    //get default minsize
    if ClientWidth  < FormMinWidth then
       ClientWidth := FormMinWidth;
    if ClientHeight < FormMinHeight then
       ClientHeight := FormMinHeight;

    //get Form's size
    if ClientWidth < SelForm.Width then
       ClientWidth := SelForm.Width;
    if ClientHeight < SelForm.Height then
       ClientHeight := SelForm.Height;

    //set Form's size
    SelForm.Width := ClientWidth;
    SelForm.Height := ClientHeight;

end;

SelForm.Repaint;

//set mainform size
form_general.Left := 0;
form_general.Top := 0;
form_general.Width := SelForm.Width;
form_general.Height := SelForm.Height;
form_general.Invalidate;

//set Top form Size
TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Height := SelForm.Height;
TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Width := SelForm.Width;
TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Invalidate;

Finally
    SelForm.ResumeLayouts;
End;
end;
 

I'm using this function on the server side to expand the screen format.

When I need to, I use DBgrid.Align := alClient and that works for me.

There is a way to do this on the client side as well, but I can't be of help there!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...