#ScaleLeft/Top Errors
10 messages in this thread
I have a problem with the ScaleLeft command causing Overflow errors and in
more complex programs multiple UAE's until Windows vaporises.
You should be able to set ScaleLeft and ScaleTop to +-32K but at +2300 or
so the error occurs. I have put SCROLL1.ZIP in the upload area but I gather
the SYSOP is not attending to the daily chores by the current chatter.
This is my first request to a CIS forum so I would appreciate any guidence
that can be given. If the ZIP does not become available I can upload the
code(it is only 20-30 lines).
PS. I am calling from the land Downunder – Vegimite, Koalas etc…
There are 3 Replies.
Graeme,
You have to be a bit careful with ScaleLeft and the other similar
properties. If you set them at runtime, your ScaleMode reverts to the User
setting. What this means is that setting any of those properties destroys
your original ScaleMode settings.
That's the reason for your overflow errors. The documentation on this
subject is a disaster. I spent almost an entire day fooling with those
properties, only to give up trying to use them for setting margins on the
Printer object.
If, however, you set them, then monkey with the ScaleMode settings, the
ScaleLeft, etc. properties translate themselves pretty well. Probably the
best option is to treat ScaleLeft, etc. as read-only at runtime.
George
There are 3 Replies.
Thanks George,
I can do the bulk of the clipping in my application so that only objects
that will fill the current view port (or enter it on one of the edges) will
be drawn and in doing so not pass the 2200 pixel barrier.
I hope Microsoft improve on the second cut of VB with documentation on view
ports and the techniques for easy scrolling.
While I am on the topic of scrolling my application was attempting to
repaint a picture with an X,Y offset so that I can view various parts of
the whole picture. Much in the same way that you would view various parts
of a drawing package such as Designer. I assume that in such packages they
BitBlt the picture to apply the actual scroll then mark the "exposed" area
as a Rectangle/Region (I really don't know the difference between these
either as both seem to have X1,Y1 – X2,Y2 co-ordinates) to be refreshed
only. If anybody could enlighten me on this I would be most appreciatine.
I know that there are a number of books now coming onto the market for VB
but as yet none of them have reached Australia (some due Nov). Can anybody
recomend a book that goes well beyond the basics – ie. not a beginners book
but Advanced Techniques! I am interested at this stage in graphics
techniqyes such as in a drawing package as this is the foundation of my
application – which by the way is driving a model railway.
There is 1 Reply.
Graeme,
I'm not sure if this will help, but there's a nifty method to do scrolling
which is used in the SCROLL.ZIP file in DL5. Basically you have a picture
control within a picture control, and the inner (child) picture control can
be larger than the outer (parent) picture control which will give you a
"window" into the child picture control, and you can then move the child
control around which will have the effect of panning. Take a look at the
file I mentioned which shows how to do this. Holler if you've got any
questions, because it can be a little confusing at first.
– Ted
Hi George,
<<…ScaleMode reverts to User setting. What this means is that setting any
of those properties destroys your original ScaleMode settings.>>
Could I get a clarification on that please. When you say, "destroy", do you
mean that the settings such as ScaleWidth, ScaleTop, etc, become undefined?
I haven't experienced this problem. However, I haven't been using these
properties on a printer object, only on a picture control.
With regards to experimenting with printing. Lordy, you are so right. It
sure would be nice to have a way to prevent Win3 from doing a Form Feed
after every print job. I'm working on an App that is going to have to be
able to output graphics to a dotmatrix, an HP laser, a Postscript laser, an
HP plotter or an electrostatic plotter running under Calcomp emulation. I
have no idea how I'm going to accomplish this and I dread starting that
phase of the project. If anyone is writing a book on VB, I hope they will
devote a large in depth chapter to the art of creating hardcopy.
KeithF
There is 1 Reply.
Keith,
What seems to happen is that, since setting ScaleLeft, etc. changes the
ScaleMode to 0 (USER), your careful CurrentX and CurrentY stuff doesn't
necessarily work.
I'm still not sure exactly what happens, and the manual isn't any help. I
experimented with it for a long time, then abandoned the effort for another
method.
Maybe someone else can explain it better.
George
George,
When you change any of the ScaleLeft/Top/Width/Height, the ScaleMode will
be set to 0 (User). This is normal and makes sense. If you change any of
the settings, you're changing the way things are scaled. Even if you're
not touching the scaling of values with ScaleHeight/Width and only change
ScaleLeft/Top, you're still changing the placement of graphics and so it
really is user scaling.
For my app, I just set it to PIXELS and forget about it because I do a lot
of API calls to the GDI and it requires coordinates in Pixels and I don't
want to have to convert coordinates all the time. While this means I have
to do my own scaling, I would have to do it anyway for various reasons, so
it's no big deal.
– Ted
There is 1 Reply.
Ted,
Well, that reset of ScaleMode to 0 may make sense for some objects, but
not for the Printer. Typically, I want to set some margins with the Scale
properties, but keep my own measurements that I'm using to send the text,
etc, to the printer in inches, or points, or whatever.
I'd like to be able to set ScaleMode, *then* set the others, without losing
my basic dimensioning system.
I dunno, there are plenty of ways to work around that, so it's no big deal.
George
Hi Graeme (and George Campbell),
George, I don't believe that Graeme's overflow problem is due to VB
changing the ScaleMode to User, but rather it is a bug in VB which was
discovered and reported shortly after the VB forum opened. The bug can be
created simply by using the VB Line command to draw a line which extends
well beyond the border of the picture. This will give an overflow no matter
what ScaleMode is active.
Graeme. Hi. What part of Australia? Beautiful, delightful, Western
Australia or somewhere else?<g> If you use the Win3 GDI functions to do
your drawing, you can avoid this overflow problem. It's more work, but
probably less than having to write your own code to clip complex objects.
Also, the GDI is somewhat faster than VB.
If you need any help with the GDI, give us a shout. I know a little bit
about it and Ted Young knows a *lot* about it.
KeithF (ex-Perthite<g>)