Jump to content

What is wrong with this implementation? (opacity on TUniPanel)


eelias

Recommended Posts

Hi there!

 

I am trying to make a TUniPanel Fadein and then Fadeout. On this panel I have only a TUniLabel.

 

I am trying to make something like the ToastMessages we find on Android Phones, those little messages that shows up for few seconds.

 

I have added a TUniTimer on the form, and I set it to fire an event on 5 seconds;

 

When showing the message i use:

 

  UniSession.AddJS(UnPanelMessage.JSName + '.animate({ duration: 1000, to: { opacity: 1 });');

 
Then, when the Timer event is fired, I use
 

  UniSession.AddJS(UnPanelMessage.JSName + '.animate({ duration: 1000, to: { opacity: 0 });');

 

However the panel just do not show up. If I remeve this line, and change my code for something like

 

UnPanelMessage.Visible := true

 

and then

 

UnPanelMessage.Visible := false

 

It works fine, so my code is working fine, the panel is visible, the color is correct, timer is working, etc.

 

But when I add the JS code it simply does not show. I have changed the opacity from 1 to 0 on start etc

 

I wonder if someone could give a hand on that.

 

Eduardo

 

 

Link to comment
Share on other sites

Hi eelias.

 

Maybe not the best solution...

 

If you created a form with
UniPanel1.Visible := False,
then
 
1. Change the Visible property to true:
    UniPanel1.Visible = True;
 
2. Then, add beforeInit to UniPanel1 -> UniEvents 
function beforeInit(sender)
{
  sender.animate({ duration: 1, to: { opacity: 0 }});
}

3. Then you can use your code.    

UniSession.AddJS(UnPanelMessage.JSName + '.animate({ duration: 1000, to: { opacity: 1 });');
UniSession.AddJS(UnPanelMessage.JSName + '.animate({ duration: 1000, to: { opacity: 0 });');
Sincerely
 
(Sorry if I misunderstood the question...)

 

Link to comment
Share on other sites

 

I am trying to make a TUniPanel Fadein and then Fadeout. On this panel I have only a TUniLabel.

 

I am trying to make something like the ToastMessages we find on Android Phones, those little messages that shows up for few seconds.

 

 

if its only for nice messages which shows up for a few seconds(or until the user moves the mouse) , take a look at humanejs notification system:

 

http://forums.unigui.com/index.php?/topic/1808-humanejs-notification-system-for-unigui/

 

works great in my actual test project.

Link to comment
Share on other sites

if its only for nice messages which shows up for a few seconds(or until the user moves the mouse) , take a look at humanejs notification system:

 

http://forums.unigui.com/index.php?/topic/1808-humanejs-notification-system-for-unigui/

 

works great in my actual test project.

 

Thank you! You helped me a lot with you code, It was exactly what I needed.

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