Tab Panel with visual effect - inconsistent?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am
Location: Montréal, Canada

Tab Panel with visual effect - inconsistent?

Post by mluka » Wed Jun 20, 2018 4:41 pm

Hi all.

I created a Tab Panel with five tabs: "Tab 1", "Tab 2",..., "Tab 5".
I also created five fields, with the same names.
I added a script to the tab panel to show the field with the same name as the tab and to hide the other four fields.
Works fine.

Then, I wanted to "experiment" with visual effects.

In the part of the script that relates to "Tab 2", in the statement that shows "Field 2", I added "with visual effect checkerboard slow". Cute, eh?

Here's the problem (and my question): If I click on "Tab 1", which shows "Field 1", then on "Tab 2", "Field 2" is shown, with the visual effect. Spectacular!

HOWEVER, if before clicking on "Tab 2", I first click on "Tab 3" or "Tab 4" or "Tab 5", "Field 2" is shown, but WITHOUT the visual effect!!!

My question: How come???

(NOTE: I probably created the five fields in the sequence 1, 2, 3, 4, 5. So the fields are probably layered in that sequence. Could this have anything to do with this behaviour???)

Thanks.
Michel
Montréal, Canada

Klaus
Posts: 13822
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Tab Panel with visual effect - inconsistent?

Post by Klaus » Wed Jun 20, 2018 4:51 pm

Bonjour Michel,

please post the script of your TAB panel!
I created a Tab Panel with five tabs: "Tab 1", "Tab 2",..., "Tab 5".
I also created five fields, with the same names.
That's great, a clever naming convention is half the rent! :-)


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Tab Panel with visual effect - inconsistent?

Post by dunbarx » Wed Jun 20, 2018 4:55 pm

Hi.

Anything to get out of doing my day job.

So I made a tab panel with five tabs as you said, and five fields with names as you said. I did this in the tab panel script:

Code: Select all

on menuPick tItemName
   repeat with y = 1 to 5
      hide fld ("tab" && y)
   end repeat
    show fld tItemName with visual effect checkerboard slow
end menuPick
Everything works fine, regardless of the tab I click on. LC 8.1.9.

By the way, "checkerboard" does not look good for the small fields I made. I tried "barn door" and it was much smoother.

Craig Newman

Klaus
Posts: 13822
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Tab Panel with visual effect - inconsistent?

Post by Klaus » Wed Jun 20, 2018 5:05 pm

Hi all,

"menupick" comes with TWO parameters, see below how to use it!

Code: Select all

on menuPick tClickedTab, tPreviousTab
   ## Set speed of visual VERY SLOW effect!
   ## Yep, strange, but it only controls the VERY SLOW effect :-D
   set the effectrate to 500
   
   ## (not so) new and HIGHLY recommended syntax!
   lock screen for visual effect
   
   ## This IS cool!
   hide fld tPreviousTab
   show fld tClickedTab
   unlock screen with visual effect dissolve very slow
end menuPick
Best

Klaus

mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am
Location: Montréal, Canada

Re: Tab Panel with visual effect - inconsistent?

Post by mluka » Wed Jun 20, 2018 7:00 pm

Hi Dunbarx and Klaus. Thanks for your replies. Like Klaus said, in another thread, there are many ways to skin a cat!

My script is much less elegant, but here it is: (BTW I had not really named the tabs and the fields as I stated in my original post, for clarity's sake :? )

Code: Select all

on menuPick pItemName
   switch pItemName
      case "Technique"     
         show field "Technique"
         hide field "Utiliser"
         hide field "Historique"
         hide field "Suggestions"
         hide field "Glossaire"
         break
      case "Comment utiliser"
         hide field "Technique"
         show field "Utiliser" with visual effect checkerboard slow
         hide field "Historique"
         hide field "Suggestions"
         hide field "Glossaire"         
         break
      case "Historique"
         hide field "Technique"
         hide field "Utiliser"
         show field "Historique"
         hide field "Suggestions"
         hide field "Glossaire"
         break
      case "Suggestions"
         hide field "Technique"
         hide field "Utiliser"
         hide field "Historique"
         show field "Suggestions"
         hide field "Glossaire"
         break
      case "Glossaire"
         hide field "Technique"
         hide field "Utiliser"
         hide field "Historique"
         hide field "Suggestions"
         show field "Glossaire"
   end switch
end menuPick
Thanks for your comments.
Michel
Montréal, Canada

Klaus
Posts: 13822
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Tab Panel with visual effect - inconsistent?

Post by Klaus » Wed Jun 20, 2018 7:05 pm

Please get used to the VISUAL EFFECT syntax I wrote above!
The dictionary is out of date, using the old syntax can even crash an iOS app!

mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am
Location: Montréal, Canada

Re: Tab Panel with visual effect - inconsistent?

Post by mluka » Wed Jun 20, 2018 9:14 pm

Please get used to the VISUAL EFFECT syntax I wrote above!
Thank you Klaus. I will, I will.
The dictionary is out of date
This is distressing! If, as a newbie, I cannot rely on the Dictionary, what should I use as a reference?
Michel
Montréal, Canada

Klaus
Posts: 13822
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Tab Panel with visual effect - inconsistent?

Post by Klaus » Wed Jun 20, 2018 9:26 pm

Don't worry, the entry in teh dictionary for "visual effect" is the only one I know that is a bit out-of-date! :D

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”