Position of a tab in a tab control.

Peter Haworth pete at lcsql.com
Fri Apr 20 20:51:53 EDT 2012


Peter,Paul(I so wish there was a Mary on the list),
Thanks for the info on Mark's tab control and the handler. I'll try both
and see works best.
Pete
On Apr 20, 2012 8:14 AM, "Peter M. Brigham, MD" <pmbrig at gmail.com> wrote:

> If using Mark's custom tab control doesn't work for you, here's a kludgy
> work-around. It requires a hidden field "hiddenTestFld" with margins set to
> 6.
>
> on positionControl btnName, tabNbr
>   -- btnName is the name of your tab button
>   put the formattedwidth of btn btnName into bWidth
>   put the formattedheight of btn btnName into bHeight
>   put item 1 of the loc of btn btnName into bCenter
>   put bWidth div 2 into halfWidth
>   put bCenter - halfWidth into bLeft
>   put bCenter + halfWidth into bRight
>   put the top of btn btnName into bTop
>   set the textfont of fld "hiddenTestFld" to the textfont of btn btnName
>   set the textsize of fld "hiddenTestFld" to the textsize of btn btnName
>   put 0 into divisions
>   repeat with n = 1 to the number of lines of btn btnName
>      put line n of btn btnName into tabName
>      put tabName into fld "hiddenTestFld"
>      put (the formattedwidth of fld "hiddenTestFld") into tWidth
>      put (item n of divisions) + tWidth into item n+1 of divisions
>   end repeat
>   put (item tabNbr of divisions) + bLeft into tabLeft
>   put (item tabNbr+1 of divisions) + bLeft into tabRight
>   put tabLeft + ((tabRight - tabLeft) div 2) into tabCenter
>   set the loc of btn "floatingControl" to tabCenter,bHeight+24
> end positionControl
>
> The result in placing the control (in this case btn "floatingControl")
> below the correct tab is not quite exact, for reasons I haven't gotten to
> the bottom of, but you could fiddle with it a bit.
>
> HTH,
> -- Peter
>
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
>
>
> On Apr 20, 2012, at 5:35 AM, Paul Hibbert wrote:
>
> > Pete,
> >
> > I may be wrong, but I don't think there's a way to control the
> differences between the two platforms without rolling your own tab control.
> >
> > However, Mark Schonewille has done much of the work and made his custom
> tab control available through RevOnline, just search for "custom tab" and
> you should find it, or the web hosted version is here…
> >
> > http://revonline2.runrev.com/stack/258/Custom-Tab-Button
> >
> > You should be able to adapt it (or copy the principles) to suit your
> needs.
> >
> > Paul
> >
> > On 20 Apr 2012, at 04:19, Peter Haworth wrote:
> >
> >> Is there a way to get hold of the coordinates of the label of the
> currently
> >> selected tab of a tab control?
> >>
> >> I have a control that I want to position immediately below the label of
> the
> >> current tab of a tab control.  I tried doing this by trial and error,
> >> adding a number of pixels to the left of the control to position it
> >> correctly.  This was all on a Mac and as soon as I tried it on a Windows
> >> machine, the control is not positioned correctly, and I suspect it
> would be
> >> affected by different screen resolutions also.
> >>
> >> Pete
> >> lcSQL Software <http://www.lcsql.com>
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list