Jump to content

Recommended Posts

Posted

Hey there.

 

I have a form full of dynamically loaded frames with tons of objects on it.. :) The question is - HOW can I create a TUniButton, what can stay on top of all other objects having fixed coordinates (relatively to web browser window)?

I tried to create the Button using standard method,setting main form as a Parent, and using BringToFront method, but the frame created before stays on top in any case..

 

Thanks in advance

Posted

I've modified a bit this event:

 

function afterrender(sender, eOpts)
{
   sender.getEl().setStyle("position", "fixed");      
   sender.getEl().setStyle("left", "5px");
   sender.getEl().setStyle("top", "5px");  
   sender.getEl().setStyle("z-index", 9999);      
}

 

But because button's parent form has AlignmentControl->Client and Layout->Fit, the button now covers all the display view :wacko:

Any idea on how to override this behaviour?

 

Meanwhile I set the main form Layout to absolute, and in OnScreenResize event put the code to control the dimensions of main container what is a Parent for all other elements (except the button).

 

What is the corerct way changing CSS style of object injecting JS? I tried without success (var_FBtnMenu - name of TUniButton):

self.var_FBtnMenu.JSInterface.JSConfig('style', [self.var_FBtnMenu.JSControl.JSObject('opacity: 0.3')]);

Posted

I finally found a solution.

Instead of using JSInterface.JSConfig, what never gave me a positive result in the code:

self.var_FBtnMenu.JSInterface.JSConfig('style', [self.var_FBtnMenu.JSControl.JSObject('opacity: 0.3')])

I tried next code and got opacity of object at UI to required value:

UniSession.AddJS('document.getElementById("'+self.var_FBtnMenu.JSControl.Id+'").style.opacity="0.3";');

Below how it looks having some additional events coded:

UniSession.AddJS('document.getElementById("'+self.var_FBtnTestMe.JSControl.Id+'").style.opacity="0.3";');
self.var_FBtnTestMe.ClientEvents.ExtEvents.Values['afterrender']:=
'function (sender, eOpts) {'+
'sender.getEl().setStyle("position", "fixed");'+
'sender.getEl().setStyle("left", "3px");'+
'sender.getEl().setStyle("top", "3px");'+
'sender.getEl().setStyle("z-index", 9999);}';
self.var_FBtnTestMe.ClientEvents.ExtEvents.Values['mouseout']:=
'function (sender, e, eOpts){sender.getEl().setStyle("opacity", 0.3);}';
self.var_FBtnTestMe.ClientEvents.ExtEvents.Values['mouseover']:=
'function (sender, e, eOpts){sender.getEl().setStyle("opacity", 1);}';

If you have any suggestions in regards of above code optimization, I would be grateful to check :)

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