Page 1 of 1

Invisible pixels

Posted: Mon Aug 31, 2015 9:40 pm
by DGDanforth
In every view there is an edge along the bottom and right sides in which pixels written are not visible.
The edge seems to be 12 pixels wide.
This may be due to incorrect clipping or to incorrect window size reporting.

If one creates a view of size (w, h) using

Code: Select all

	PROCEDURE (v: View) HandlePropMsg- (VAR msg: Properties.Message);
	VAR
		w, h:	INTEGER;
		stretch:	BOOLEAN;
	BEGIN
		WITH msg: Properties.FocusPref DO
		  msg.setFocus := TRUE
		| msg: Properties.SizePref DO
			IF v.ReadSize(w, h) THEN
				msg.w :=  w * HostWindows.unit;
				msg.h := h * HostWindows.unit
			END
		| msg: Properties.ResizePref DO
			IF v.ReadStretch(stretch) & stretch THEN
				msg.horFitToWin := TRUE; msg.verFitToWin := TRUE
			ELSE
				msg.horFitToWin := FALSE; msg.verFitToWin := FALSE
			END
		ELSE
		END
	END HandlePropMsg;
Then the actual size returned on subsequent calls to

Code: Select all

		
VAR win:	HostWindows.Window;
	win.GetSize(nWidth, nHeight);
are not equal to the original requested size (nWidth, nHeight) # (w,h). They are similar but not equal.
Even that would be OK (kind of) if one could write into all of (nWidth, nHeight) but one can't.
One must provide an "adjustment" that either scales the whole window or changes the effective window size.
That should not be necessary and I consider this to be a bug.

-Doug

Re: Invisible pixels

Posted: Tue Sep 01, 2015 7:34 am
by Josef Templ
A possible explanation might be that you are setting the size of a view but you are
checking the size of a window. Is a window the same as a view?
It may be that the view is part of the window and the window adds some decoration
around it. The window is what you see on the screen.
I have never done this but it may be possible to create a window without any decoration.

- Josef

Re: Invisible pixels

Posted: Thu Sep 03, 2015 3:31 am
by DGDanforth
Josef,

If the view is resized by dragging a handle then one needs a way of determining the new size.
The only way I know how to do that is to use win.GetSize where win is determined at the time
the view is opened. But there still remains the issue of determining the effective drawing
area. My 12 pixel comment was determined by trial and error. What is the actual rule?

Yes, I believe it is possible to create a view that is not decorated. I think I did that in the
distant past. I think such views are called "sprites" (not sure).

I do a great deal of view programming for showing the results of physics experiments.
It is very important that graphs come out looking correct.

-Doug

Re: Invisible pixels

Posted: Tue Jan 12, 2016 5:59 am
by Ivan Denisov
Doug, you should use not

Code: Select all

win.GetSize(nWidth, nHeight);
but

Code: Select all

view.context.GetSize(w, h);

Re: Invisible pixels

Posted: Tue Jan 12, 2016 7:09 am
by luowy
You need to look at Documents.StdDirectory.New to understand what happen.

a regular view can not opened directly in a window,
it has to be wrapped into rootview: a document,
the document( assigned to window.doc, as a rootview of window)has a defaultBorder defB = 8 * point;
then the window can be opened by the windows manager of framework.
so the call view.context.GetSize(w, h) cant get the window's W,H

luowy

Re: Invisible pixels

Posted: Tue Jan 12, 2016 7:27 am
by DGDanforth
luowy wrote:You need to look at Documents.StdDirectory.New to understand what happen.

a regular view can not opened directly in a window,
it has to be wrapped into rootview: a document,
the document( assigned to window.doc, as a rootview of window)has a defaultBorder defB = 8 * point;
then the window can be opened by the windows manager of framework.
so the call view.context.GetSize(w, h) cant get the window's W,H

luowy
Thank you luowy. I also notice the mention of HostWindows which has a borderW = 5 * Ports.point.

GRIPE: BlackBox has ports, frames, views, windows, and documents. That feels wrong to me. Too many constructs.