Locate

new BookmarkLockedFalling
aristarkos
New Member
*

aristarkos Avatar

Posts: 48

StefanPendl
Global Moderator
*****

StefanPendl Avatar

Run for BASIC ...
Posts: 945

Last Edit: Jan 12, 2009 2:08:36 GMT -5 by StefanPendl
[b]Stefan[/b] - [a href=http://stefanpendl.runbasichosting.com/]Homepage[/a][br][br][b]Please give credit if you use code I post, no need to ask for permission.[/b][br][br]Run BASIC 1.01, Fire-/Waterfox (IE11, Edge), Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
aristarkos
New Member
*

aristarkos Avatar

Posts: 48

Post by aristarkos on Jan 12, 2009 11:00:45 GMT -5

The program is a MasterMind-type game. There is a constant input of numbers as a list grows. The questions appear below the growing list. Variables are used with Locate so that the list is added to at the bottom row each time. As this happens Print is used to erase old questions, before new questions appear with a changed location. So the program doesn't remember every individual number from the past as the list grows; the numbers just stay on the screen with careful use of Locate and Print.

So with this in mind, what should I do in Run Basic without Locate? Can CSS use variables that control the position of text display?
Janet
Global Moderator
*****

Janet Avatar

Posts: 276

Post by Janet on Jan 12, 2009 16:10:56 GMT -5

Since each display of the screen is a new render, you may have to rethink your approach. You could use an array to just store each line of text. Or, you could print to a text area, capturing the information in the textarea first, placing that information in a variable, then appending the variable with the new information.
[br]
aristarkos
New Member
*

aristarkos Avatar

Posts: 48

kokenge
Senior Member
****

kokenge Avatar

Posts: 261

Post by kokenge on Jan 14, 2009 12:55:02 GMT -5

Not sure how many rows and columns you have or exactly what your doing.
But, why not simply give each row and column a unique ID and display there.
Something simple like this:

html "<TABLE border=1><TR><TD colspan=2 align=center bgcolor=tan>Row Col</TD></TR><TR>"
html "<TD align=right>Number of Rows</td><td>"
TEXTBOX #r, "",3
html "</TD></TR><TD align=right>Number of Columns</td><td>"
TEXTBOX #c, "",3
html "<TR><TD colspan=2 align=center bgcolor=tan>"
button #parm, "Set Parameters", [parm]
html " "
button #ex, "Exit", [doExit]
html "</TD></TR></TABLE>"
wait
[parm]
r = val(#r contents$())
c = val(#c contents$())

html "<TABLE border=1><TR bgcolor=tan align=center><TD><B>Row</TD>"
for i = 1 to c
html "<TD><B>Col ";i;"</TD>"
next i

for i = 1 to r
html "<TR><TD align=center>";i;"</TD>"
for j = 1 to c
html "<TD id=rc";i;j;"></TD>"
next j
html "</TD></TR>"
next i
html "<TR bgcolor=tan><TD align=center colspan=";c + 1;">"
html "Enter Row 1 to ";r
textbox #r,"",3
html " Column 1 to ";c
textbox #c,"",3
html " "
button #disp, "Display", [disp]
html "</TD></TR></TABLE>"
wait
[disp]
r$ = #r contents$()
c$ = #c contents$()

print "Row:";r$;" Col";c$
html "<script> document.getElementById('rc";r$;c$;"').innerHTML = '";r$;" ";c$;"';</script>"
wait

' -----------------------------------------
' Get outta here
' -----------------------------------------
[doExit]
html "<script language='javascript' type='text/javascript'>
var a = history.length;
a = a - 1;
window.open('','_parent','');
window.close();
history.go(-a);
</script>"


Hope this helps a little..
Carl Gundel - admin
Administrator
*****

Carl Gundel - admin Avatar

Posts: 550

kokenge
Senior Member
****

kokenge Avatar

Posts: 261

Janet
Global Moderator
*****

Janet Avatar

Posts: 276

Post by Janet on Jan 14, 2009 16:37:37 GMT -5

kokenge Avatar
Not sure how many rows and columns you have or exactly what your doing.
But, why not simply give each row and column a unique ID and display there.
Something simple like this:

There are so many tips, tricks, and technques that have been written on this forum, and so many offered by Dan. I'd just like to thank all contributers who so freely share their knowledge. :)

Janet
[br]
aristarkos
New Member
*

aristarkos Avatar

Posts: 48

Post by aristarkos on Jan 20, 2009 20:05:57 GMT -5

Thanks for the ideas. I forgot to check back here after I got an array working. It was easier than I thought (it frequently is). My program will now remember every past value of every step. So when I use Print to display, it can display from a clear screen and re-print what I need it to.

The advantage of using Locate the way I did before, however, is that it was faster ... a selective erasing and printing instead of having to re-print everything.