Tabs with icons

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
larryh
Posts: 32
Joined: Sat Mar 22, 2008 6:02 pm

Tabs with icons

Post by larryh » Thu Apr 03, 2008 6:37 pm

I am trying to create tabs with labels and a little icon at the beginning of the label. So what I did was create a tab menu with spaces before each label.

___ TabMenu1
___ TabMenu2
etc.

Then I placed graphics on the tab menus where the spaces are.

Looks fantastic in Vista, but when I try it in Windows XP all the little button graphics have shifted position with respect to tab menus. The graphics are locked so the tab menus are changing size due to OS differences.

There must be a better way to do this. Is there a way to embed the graphic in the tabmenu name itself?

Thanks!

Larry

larryh
Posts: 32
Joined: Sat Mar 22, 2008 6:02 pm

Post by larryh » Thu Apr 03, 2008 6:54 pm

I am trying to do something like this but without success:

set the imageSource of char 1 of label of menuHistory 1 of btn "bTabMenu" to 1284

1284 is a tiny icon.

Larry

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Post by Janschenkel » Thu Apr 03, 2008 8:46 pm

Hi Larry,

You're going to have to "roll your own tabs" - the Rev engine doesn't support icons in the tabs. This feature was requested in the quality center, but has so far not been implemented - every vote helps to convince the team!
http://quality.runrev.com/qacenter/show_bug.cgi?id=2400

In the meantime, you can plop down a few "square" buttons next to one another, group them together and set the script of the group to something like:

Code: Select all

on mouseUp
  lock screen
  put the number of controls of me into tControlCount
  repeat with tCurrentControl = 1 to tControlCount
    set the hilite of button tCurrentControl of me to false
  end repeat
  set the hilite of the target to true
  -- for learning purposes, display which 'tab' is hilited
  answer the hilitedButton of me
  -- now do the appropriate showing/hiding of controls
  unlock screen
end mouseUp
Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

larryh
Posts: 32
Joined: Sat Mar 22, 2008 6:02 pm

Post by larryh » Thu Apr 03, 2008 10:59 pm

Thanks Jan,

That helps. You inspired me to try something else. I created a tab group with four empty tabs of 20 space characters each. Then I plopped a field on top of each tab. In the field I can set imageSource to the icons. So now I have something that basically looks like a tab with an icon.

Larry

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Post by Janschenkel » Fri Apr 04, 2008 5:35 am

Overlaying the tab with fields will also work, of course - the tricky part about that, is that tabs may have different locations on different platforms.
On MaxOSX, the tabs are displayed in the center rather than the topleft. On Windows, tabs may have different sizes depending on whether it is the Windows Classic look, Windows XP look and Windows Vista look. And on Linux, you may be dependent on themes that are varying wildly.

All in all, the best solution would be if the engine supported this feature. In the meantime, creating your own tabbed buttons is not too difficult and allows you to play with icons and other settings.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

larryh
Posts: 32
Joined: Sat Mar 22, 2008 6:02 pm

Post by larryh » Fri Apr 04, 2008 7:22 am

Yep... you are right. I thought my solution would work but it still has the same multiplatform issues. I'll try the buttons as you suggested earlier.

Larry

Post Reply

Return to “Talking LiveCode”