Jump to content

set Position of TuniForm with javascript ..


erich.wanker

Recommended Posts

Hello,

 

 

How can i refresh the content (unipanels, grids and so on..) AFTER i changed the position of a UniForm?

 

A uniPanel with Align = alRight  or a Grid or a UniContainerpanel and so on do not have the right position after changing the form.width or form.height property

 

 

var x,y,h,w:Integer;
new_top,
new_left,
new_height,
new_width :Integer;
begin


new_width:=trunc((mainform.Width-(mainform.r_links+mainform.r_rechts)));
new_height:=trunc((mainform.Height-(mainform.r_oben+mainform.r_unten)));
new_left:=mainform.r_links;
new_top:=mainform.r_oben;




UniSession.AddJS(self.WebForm.JSName+'.el.setStyle("left", '+inttostr(new_left)+');');
UniSession.AddJS(self.WebForm.JSName+'.el.setStyle("top", '+inttostr(new_top)+');');
UniSession.AddJS(self.WebForm.JSName+'.el.setStyle("width", '+inttostr(new_width)+');');
UniSession.AddJS(self.WebForm.JSName+'.el.setStyle("height", '+inttostr(new_height)+');');

 

 

 

 

 

 

 

 

WHY i search a solution???

 

I hope the javascript funkction is a solution for wrong positions , since i use a "animate-effect" for TuniForms:

 

to animate a window, i use clientEvents/ ExtEvents:

function window.afterrender(sender, eOpts)
{
       function FixMe()
   {
    V_FRAME_VERTRAG_STRUKTUR.UniDBGrid3.doLayout( );
    V_FRAME_VERTRAG_STRUKTUR.UniDBGrid2.doLayout( );
   }
   var posi = Math.trunc(($(window).height() - this.getHeight())/2);
   
   TweenLite.set('#'+sender.getId()+'',     {autoAlpha:0,y:-1000,display:"block"});
   setTimeout(function() {
TweenLite.to('#'+sender.getId()+'', 0.5, {autoAlpha:1,y: posi,   display:"block", ease:Back.easeOut.config(1), onComplete:FixMe});   
   }, 200); 
}

works fine

 

 

 

 

 

BUT in my TMainForm.UniFormScreenResize -> i start the public procedure "resizing" in all open TuniForms 

 

Worked fine - still i use the animate function  :-( 

 

Now - the procedure makes a wrong position of the open TuniForms... without the animation-effect everything works fine!!!!

 

Example:

procedure TV_FRAME_VERTRAG_STRUKTUR.resizing;
var x,y,h,w:Integer;
begin
self.Width:=trunc((mainform.Width-(mainform.r_left+mainform.r_right)));
self.Height:=trunc((mainform.Height-(mainform.r_top+mainform.r_bottom)));
self.Left:=mainform.r_left;
self.Top:=mainform.r_right;

the Top position is not correct ....

 
 
r_left ..  and so on are the distance values of the edges 
 

 

it seems that the javascript makes a position of the form -- and delphi thinks the form is on a other place .. and the change in delphi-code of self.top is interpreted on client-side as "move the form x pixles up or down / not set top to coordinates )

 

 

ThanX

Erich

 

 

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