LB Booster
Programming >> Liberty BASIC language >> LOCATE command without width/height
http://lbb.conforums.com/index.cgi?board=lblang&action=display&num=1489511792

LOCATE command without width/height
Post by Richard Russell on Mar 14th, 2017, 5:16pm

The LB 4.50 Help file describes the graphics LOCATE command as follows:

Code:
print #handle, "locate x y width height" 

There is no mention that any of the parameters can be omitted, but I've recently encountered this command in a Liberty BASIC program:

Code:
    #DG.GB, "locate -1 -1" 

What does this do? Whatever it is, it doesn't (currently) work in LBB!

Richard.
Re: LOCATE command without width/height
Post by Rod on Mar 15th, 2017, 6:12pm

I think it is just crap code. It used to be necessary to locate off screen to draw hidden graphics and then show the graphics. That was prior to show and hide. Also getbmp used to behave differently for an off screen graphicbox but not now, and not for a long time.

Liberty fails to notice the missing parameters however it ignores the locate/refresh pair unless they are properly formatted

I would throw an error if the parameters are missing.
Re: LOCATE command without width/height
Post by Richard Russell on Mar 18th, 2017, 10:41am

on Mar 15th, 2017, 6:12pm, Rod wrote:
I would throw an error if the parameters are missing.

That (or simply ignoring the command) would be a simple solution, but I'm thinking that a useful language extension might be to interpret the missing parameters as meaning 'change the position but don't change the size'. It would then be possible to use LOCATE to move a control without needing to know how big it is.

Does that sound sensible?

Richard.

Re: LOCATE command without width/height
Post by RobM on Mar 18th, 2017, 4:27pm

on Mar 18th, 2017, 10:41am, Richard Russell wrote:
Does that sound sensible?

Yes. Most of the time when I use the locate command I do not need to resize the control, just move it where needed.