Tabbed Panel Highlights

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Admatha
Posts: 2
Joined: Thu Mar 18, 2010 3:14 pm

Tabbed Panel Highlights

Post by Admatha » Thu Mar 18, 2010 4:39 pm

I have create a tabbed panel with tabs A, B, & C.

Tab A is highlighted in blue and will not respond to a click until I click one
of the other tabs.

Is there a way to be able to click the highlighted tab and have
it work the first time? or maybe a way to have none of the tabs highlighted?

The test script that I have been using with the 3 tabbed panel A, B, C, is as follows:

on menuPick theItem -- in a pulldown menu
if theItem is "A" then
beep
exit menuPick
end if

if theItem is "B" then
repeat 2 times
beep
wait 200 milliseconds
end repeat
exit menuPick
end if

if theItem is "C" then
repeat 3 times
beep
wait 200 milliseconds
end repeat
exit menuPick
end if
end menuPick

Would appreciate possible solutions,

Thanks,

Errol

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Tabbed Panel Highlights

Post by sturgis » Thu Mar 18, 2010 5:17 pm

THe reason it doesn't work is that menuPick only fires when the chosen menu item is changed. If you click the same tab, it won't fire. If you instead switch to a mouseUp handler instead of menupick it should work fine. In fact, it does, here is the modified code.

Code: Select all

on mouseUp
   put menuitem (the menuhistory of me) of me into theItem
   if theItem is "A" then
      beep
      exit mouseUp
   end if
   
   if theItem is "B" then
      repeat 2 times
         beep
         wait 200 milliseconds
      end repeat
      exit mouseUp
   end if
   
   if theItem is "C" then
      repeat 3 times
         beep
         wait 200 milliseconds
      end repeat
      exit mouseUp
   end if
end mouseUp
Here is an example doing the same thing with a switch/case structure to replace the If's just to show alternate methods.

Code: Select all

on mouseUp
   switch menuitem (the menuhistory of me) of me
      case "A"
         beep
         break
      case "B"
         repeat 2 times
            beep
            wait 200 milliseconds
         end repeat
         break
      case "C"
         repeat 3 times
            beep
            wait 200 milliseconds
         end repeat
         break
   end switch
end mouseUp
Admatha wrote:I have create a tabbed panel with tabs A, B, & C.

Tab A is highlighted in blue and will not respond to a click until I click one
of the other tabs.

Is there a way to be able to click the highlighted tab and have
it work the first time? or maybe a way to have none of the tabs highlighted?

The test script that I have been using with the 3 tabbed panel A, B, C, is as follows:

on menuPick theItem -- in a pulldown menu
if theItem is "A" then
beep
exit menuPick
end if

if theItem is "B" then
repeat 2 times
beep
wait 200 milliseconds
end repeat
exit menuPick
end if

if theItem is "C" then
repeat 3 times
beep
wait 200 milliseconds
end repeat
exit menuPick
end if
end menuPick

Would appreciate possible solutions,

Thanks,

Errol

Admatha
Posts: 2
Joined: Thu Mar 18, 2010 3:14 pm

Re: Tabbed Panel Highlights

Post by Admatha » Thu Mar 18, 2010 5:48 pm

Fantastic! I have tested your mouseUp and it works just as you said. I am new to the Forum and am really impressed that I got the right help the first time in less than an hour.

Thank you very much,
Errol

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Tabbed Panel Highlights

Post by Klaus » Thu Mar 18, 2010 8:09 pm

Hi Errol,

welcome to the forum!

Please take a look at and go through (some of) these great tutorial stacks at:
http://www.runrev.com/developers/lesson ... nferences/

And of course don't hesitate to ask here :)


Best from germany

Klaus

Post Reply