Jump to content

Form close problem


MVakili

Recommended Posts

I use this procedure to create a runtime form with HTMLFrame

procedure TDMT.ShowListStart(TTl: STring);
Var
   F : TUniForm;
   RollingStone : TUniHTMLFrame;
Begin
    F := TUniForm(UniApplication.FindComponent('MyShowListName'));
    if Assigned(F) then
       FreeAndNil(F);
     F := TUniForm.Create(UniApplication);
     With F Do
        Begin
//           Parent:=MainForm;
           AlignmentControl:=uniAlignmentServer;
           ClientHeight := 512 ;
           ClientWidth := 1248;
           OldCreateOrder := False   ;
           Width:=Round(Screen.Width/4);
           Height:=Round(Screen.Height/2);
           Left:=Screen.Width-Round(Screen.Width/8);
           Top:=Screen.Height-Round(Screen.Height/4);
           Position:=poScreenCenter;
           BorderStyle:=bsSingle;
           BorderIcons:=[biMaximize,biSystemMenu];
           Name:='MyShowListName';
           KeyPreview:=True;
           Rtl:=False;
           Caption:='';
           CaptionAlign:=taCenter;
           FormStyle:=fsStayOnTop;
           OnKeyDown:= KeyDownConfig;
           Caption:=TTl;
           FreeOnClose:=True;
        End;
     RollingStone:=TUniHTMLFrame.Create(F);
     With RollingStone Do
        Begin
           Parent:=F;
           AlignWithMargins := True;
           RTL := True;
           Align:=alClient;
           AutoScroll := True;
           Name:='MyShowListRollingStoneName';
        end;

End;

And I use the normal form buttons to close it.
This form closes without issue when called on a frame
But if it is called while working on a form, the regular close button cannot close the form
The form is designed as a server side


How can I solve this problem?

Link to comment
Share on other sites

  • MVakili changed the title to Form close problem

Solved 😀

procedure TDMT.ShowListStart(TTl: STring);
Var
   F : TUniForm;
   RollingStone : TUniHTMLFrame;
Begin

    F := TUniForm(UniApplication.FindComponent('MyShowListName'));
    if Assigned(F) then
       FreeAndNil(F);

     F := TUniForm.Create(UniApplication);
     With F Do
        Begin
           AlignmentControl:=uniAlignmentServer;
           ClientHeight := 512 ;
           ClientWidth := 1248;
           OldCreateOrder := False   ;
           Width:=Round(Screen.Width/4);
           Height:=Round(Screen.Height/2);
           Left:=Screen.Width-Round(Screen.Width/8);
           Top:=Screen.Height-Round(Screen.Height/4);
           Position:=poScreenCenter;
           BorderStyle:=bsSingle;
           BorderIcons:=[biMaximize,biSystemMenu];
           Name:='MyShowListName';
           KeyPreview:=True;
           Rtl:=False;
           Caption:='';
           CaptionAlign:=taCenter;
           FormStyle:=fsStayOnTop;
           OnKeyDown:= KeyDownConfig;
           Caption:=TTl;
           FreeOnClose:=True;

        End;
     RollingStone:=TUniHTMLFrame.Create(F);
     With RollingStone Do
        Begin
           Parent:=F;
           AlignWithMargins := True;
           RTL := True;
           Align:=alClient;
           AutoScroll := True;
           Name:='MyShowListRollingStoneName';
        end;
   F.Show;

End;

 

  • Like 2
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...