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

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