--- In [email protected], "brucexs" <[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "Sheri" <sherip99@> wrote:
> >
> > I'm having some trouble with automatically positioning a floating
> > bar. The bar initially has a right caption position. It is
> > autoshown upon use in a script of 
> > 
> > cl.import(kbfile)
> > cl.show(bname)
> > 
> > (where kbfile is an ini file for a bar named bname).
> > 
> > What I want to do is change the bar to floating, but have its
> > initial position be unchanged.
> > 
> > I tried adding:
> > 
> > local myrec=win.getrect(bname)
> > 
> > win.getrect is documented as returning left top right bottom
> > whereas
> > cl.setrect is documented as needing cl, top, left, right, bottom
> 
> 
> Doc is wrong.  setrect uses left top right bottom too.
> 
> You may have to close bar, reset to float and pos, then show bar.
> > 
> > So I tried manipulating myrec to look like what cl.setrect uses
> > but that didn't work. If I used Any idea what I'm doing wrong? 
> 
> 
> No  How much does the bar move in the second case?  what does 
> win.getrect return before and change in pos
>

I neglected to mention the ini file format sets horizontal and
vertical offsets. Apparently they are not accounted for by
win.getrect. I found that it works if I name those in NewProperties
(same offset figures that are in the ini file with RightCaption)

local myrec=win.getrect(bname)
cl.NewProperties(bname, "Format1=Position: Floating HOffset: -40
VOffset: 32")
win.setrect(bname, myrec)

in order to use cl.setrect it needs:
cl.setrect(bname, word(myrec, 1, " "), word(myrec, 2, " "),
word(myrec, 3, " "), word(myrec, 4, " "))

No need to close and reshow the bar with either of the setrect
alternatives.

Regards,
Sheri

Reply via email to