Larry
New Member
Posts: 40
|
Post by Larry on Apr 29, 2020 15:57:49 GMT -5
Could we possibly do another print to graphics window command like the current "\" and "\" but that does not do a line feed unless you put the "\" in your text. Using Inkey$ and adding to a variable like a$=a$+Inkey$, you type a line now, and you get the following:
t th thi this this i this is this is a this is a t this is a te this is a tes this is a test.
The linefeed kicks in and even when I use the place, or posxy command it over-rides it somehow and still does the linefeed in lb404 pro. Is there something I am missing?
|
|
|
Post by Brandon Parker on Apr 29, 2020 19:19:31 GMT -5
Most likely in implementation...
You would need some type of marker to mark what you want to be the end of the string and only print it out if you encounter that marker. Then you would clear the a$ variable and start anew.
{:0)
Brandon Parker
|
|
|
Post by svajoklis on May 5, 2020 23:58:32 GMT -5
Well if you leave a semicolon after last parameter to print you skip the newline and you can always just do another "print" statement to skip to new line. If you always printed a$ even with this it would be printed as
tththithisthis ithis isthis is a this is a t
Since that's what you're actually doing by printing out the a$ for each keystroke.
Like Brandon said, if you wanted this effect, then you should just print the Inkey$ value when you type a key and keep a buffer a$ that contains all previously printed characters.
What is it that you are actually trying to do? It seems like this request is a part of some bigger application.
|
|
|
Post by Chris Iverson on May 6, 2020 1:14:50 GMT -5
It sounds like he wants to echo keystrokes on the graphicbox, like simulating a text box.
Don't know about overriding posxy, though.
EDIT: Oh, duh. posxy isn't used for changing the drawing pen's position; it's used to GET the current position of the drawing pen.
If you want to keep resetting it to the top, you have to use PLACE or GOTO. (I recommend PLACE, which will move the pen without drawing on the screen, even if the pen is down.)
EDIT2: Here's a working example.
nomainwin open "test" for graphics as #test #test, "color black" #test, "down" #test, "when characterInput [doInput]" #test, "trapclose [quit]" #test, "setfocus" wait
[doInput] if len(Inkey$) > 1 then modifier = asc(left$(Inkey$, 1)) end if
char$ = right$(Inkey$, 1) charVal = asc(char$)
if charVal = _VK_BACK then if swallowFirstBackspace = 1 then dispString$ = left$(dispString$, len(dispString$) - 1) gosub [refreshScreen] swallowFirstBackspace = 0 else swallowFirstBackspace = 1 end if end if
if charVal = _VK_RETURN then if swallowFirstReturn = 1 then dispString$ = dispString$ + char$ swallowFirstReturn = 0 else swallowFirstReturn = 1 end if end if
if charVal > 31 AND charVal < 127 then dispString$ = dispString$ + char$ gosub [refreshScreen] end if
wait
[refreshScreen] #test, "place 10 10" #test, "fill white" #test, "\" + dispString$ return
[quit] close #test
I will agree with this wishlist request, though, in that it would be nice to have a way to prevent the "line feed" from happening.
|
|
|
Post by Rod on May 6, 2020 1:43:52 GMT -5
Yes but get posxy does not help because the next print position depends on the length of the currently printed text. The usual solution is to use a fixed width font and keep count of the character position. I think it is the difficulty of knowing the pixel length of any variable width font that limits our functionality.
|
|
|
Post by Gordon Rahman on Jul 20, 2020 10:45:55 GMT -5
A better LB graphic window. A hand cursor. Gordon
|
|
cundo
Full Member
Muchas Gracias!!
Posts: 146
|
Post by cundo on Jul 20, 2020 11:37:23 GMT -5
A better LB graphic window. A hand cursor. Gordon A load cursor from disk Command ...
|
|
|
Post by Carl Gundel on Jul 20, 2020 15:38:17 GMT -5
A better LB graphic window. A hand cursor. Gordon What is a better LB graphic window?
|
|
|
Post by Carl Gundel on Jul 20, 2020 15:38:44 GMT -5
A better LB graphic window. A hand cursor. Gordon A load cursor from disk Command ... Please describe what this means.
|
|
|
Post by Gordon Rahman on Jul 20, 2020 15:42:28 GMT -5
A better LB graphic window. A hand cursor. Gordon A load cursor from disk Command ... Hi Cundo, I was thinking of the sixth extra LB system cursor as we already have: NORMAL= the default pointer ARROW= the standard Windows arrow CROSSHAIR= a + shaped pointer HOURGLASS= the Windows hourglass TEXT= the text insertion I-beam HAND = the Window like cursor needed to put focus (or select) when hovering over an item. Gordon
|
|
cundo
Full Member
Muchas Gracias!!
Posts: 146
|
Post by cundo on Jul 20, 2020 15:51:27 GMT -5
I had this *somewhat redundant* idea of loading cursors from .cur files. I don't know if it would be useful, currently in games, hiding the mouse cursor and using a sprite as a new game pointer works well. Can we hide the cursor in LB4/LB5? can't remember.
|
|
|
Post by Gordon Rahman on Jul 20, 2020 15:57:02 GMT -5
A better LB graphic window. A hand cursor. Gordon What is a better LB graphic window? I meant ... one that is even better than MS graphicbox.
|
|
|
Post by Carl Gundel on Jul 20, 2020 16:20:05 GMT -5
What is a better LB graphic window? I meant ... one that is even better than MS graphicbox. Sorry, I still don't understand.
|
|
|
Post by Gordon Rahman on Jul 20, 2020 17:35:08 GMT -5
I placed a listing at LB4.5.1 today. The "home" command (function) won't work properly in MS Windows (with a graphicbox of course) without Stylebits.....
It will miss the "home" by one pixel if we ignore a stylebits to ignore the WS_Border. While the LB4 graphic window will just ignore stylebits completely .. and so misses the "home" by 4 to 16 pixels in all cases.
So I made a joke and asked to make the LB graphic window at least as good as the MS box at this point or even better. So "home" without stylebits?
I like LB better then VB and so on ... and we have lived with this quirk in LB for years ... so don't hurry, but I hope we don't forget it in LB5
I think "home means "home" without stylebit correction?
Gordon
|
|
|
Post by Carl Gundel on Jul 20, 2020 17:39:22 GMT -5
I placed a listing at LB4.5.1 today. The "home" command (function) won't work properly in MS Windows (with a graphicbox of course) without Stylebits..... It will miss the "home" by one pixel if we ignore a stylebits to ignore the WS_Border. While the LB4 graphic window will just ignore stylebits completely .. and so misses the "home" by 4 to 16 pixels in all cases. So I made a joke and asked to make the LB graphic window at least as good as the MS box at this point or even better. So "home" without stylebits? I like LB better then VB and so on ... and we have lived with this quirk in LB for years ... so don't hurry, but I hope we don't forget it in LB5 I think "home means "home" without stylebit correction? Gordon Home to me means to center the pen. For most uses it isn't really critical. Can you give me a super simple example that works objectionably different on LB5 than on LB4? Sorry if I'm being dense.
|
|