Known Problems with Icon Graphics under Windows
CSc 451, Spring 2003
Last Update: April 16, 2003, 2:01am
Problem: The pointerx and pointery attributes produce values that are frame-relative rather than canvas relative.
Solution: Subtract a fudge factor. Example:
$ifdef _MS_WINDOWS
$define XFUDGE 4
$define YFUDGE 23
$else
$define XFUDGE 0
$define YFUDGE 0
$endif
link graphics
procedure main()
WOpen("size=300,300")
repeat {
x := WAttrib("pointerx") - XFUDGE
y := WAttrib("pointery") - YFUDGE
if not (x = \lastx & y = \lasty) then {
WWrite("(", x, "," , y, ")")
lastx := x
lasty := y
}
WDelay(10)
}
end
Note that the fudge factor is dependent on both which version of Windows is in use and the border width settings.
Problem: Keystroke events have an associated &x and &y that are relative to the upper left hand corner of the display screen.
Solution: Subtract posx, posy, and the abovementioned fudge factor. Example:
link graphics
$ifdef _MS_WINDOWS
$define XFUDGE 4
$define YFUDGE 23
$else
$define XFUDGE 0
$define YFUDGE 0
$endif
procedure main() # key3a
WOpen("size=300,400")
repeat {
e := Event()
WWrites(if &control then "c" else "-")
WWrites(if &shift then "s" else "-")
WWrites(if &meta then "m" else "-")
x := &x; y := &y
$ifdef _MS_WINDOWS
if type(e) == "string" then {
x -:= WAttrib("posx") + XFUDGE
y -:= WAttrib("posy") + YFUDGE
}
$endif
WWrite(" ", left(image(e),7), left("("||x||","||y||")", 12),
right(&interval,6), "ms")
}
end
Unicon-specific: Key events are frame relative, but need fudging. For example, on NT4SP6 the upper left corner of the drawable area is (-4,-5)
Problem: drawop=reverse does work with DrawString.
Solution: I'd like to hear a good one, but failing that... For dragging text, the original text could be drawn in the background color and a surrogate such as a box could be dragged.
Problem: Vidgets have a tiny font and there seem to be issues related to font size such as text vidgets improperly updating.
Solution: It seems that the problem can be fixed by recompiling one file. Do this:
cd X:\winicon\ipl\gprocs
wicont -c viface.icn
A subsequent build of the vidget-using program should yield a better result.
The above assumes that X:\winicon is the root directory for your Windows Icon installation.
Problem: Text vidgets don't accept keystroke input.
Workaround: This problem is apparently related to keystroke events being display-relative rather canvas-relative. If you position the window in the upper left corner of the display and put the pointer just above the vidget, the events are received. (ICK!)
Unicon-specific: As noted in another item, text events with Unicon are frame-relative. That reduces the problem to one of the minor offset mentioned ((-4,-5) for NT4SP6).