#compact
$ filename "t.exe"
'uses RTL64
uses ConsoleG
'USER CONTROLS:
'==============
'
'mouse controls:
' left-click
'
'keyboard controls:
' arrow keys
' tab shift-tab
' PgUp PgDn to inc/dec values (SHIFT step 10)
function irnd(int z1, z2) as int
================================
mov eax,z2
sub eax,z1
inc eax
imul edx,Seed,0x8088405
inc edx
mov Seed,edx 'store new seed
mul edx 'multiply eax by edx
return edx+z1
end Function
'
redim int ytot[5,1] static
redim string dat[5,5] static
procedure main()
================
sys a,i,p
static string ins
static string s
if opening
'INTIAL EXAMPLE DATA
int x,y
for y=lbound(dat,1) to ubound(dat,1)
for x=lbound(dat,2) to ubound(dat,2)
dat[y,x]=str irnd(0,99)
next
next
'
endif
'
if closing
del ytot
del dat
'mbox "closed"
exit procedure
endif
cls .05,.20,.00
'
'GRID INPUTS
------------
scale 1.5
int x,y
pushstate
move 4,-1
scale 1.5
print "GRID TITLE"
popstate
move 0,-3
'
picklabel 0
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4
print "Col " chr(x+64)
PopState
next
PushState
move x*4
print "Total"
PopState
'
picklabel 0
for y=lbound(dat,1) to ubound(dat,1)
PushState
move 1, -y*2
print "R" str(y)
PopState
next
PushState
move 1, -y*2
print "Total"
PopState
'
int v
int gtot=0
for x=lbound(dat,2) to ubound(dat,2)
ytot[x]=0
next
'
'backgound underlay
if not pick
color 0,.3,0
move 3,-0.5,-.015
PutBoxArea ubound(dat,2)*4,ubound(dat,1)*-2
move -3,0.5, .015
endif
'
for y=lbound(dat,1) to ubound(dat,1)
int xtot=0
for x=lbound(dat,2) to ubound(dat,2)
v=val(dat[y,x])
xtot+=v
ytot[x]+=v
PushState
move x*4,-y*2
if pick
'MARK PICKING AREA
picklabel y*10+x
move 0,0,-.01
PutBoxArea 3,1
move 0,0, .01
else 'not pick
if picked=y*10+x
'DATA EDITING
'
color 0.9,0.9,0.9
'box-around
glBegin GL_LINE_STRIP
glVertex2f 0,0
glVertex2f 3,0
glVertex2f 3,1
glVertex2f 0,1
glVertex2f 0,0
glEnd
'
move 0.2,0.2,.01
----------------
a=input dat[y,x]
----------------
static int cpick,cy,cx
if cpick<>picked
cp=le+1 'place cursor at end of string
cy=y
cx=x
cpick=picked
endif
'
'stepper by digit positiom
'int dg
'dg=le-cp+1
'if dg<1 then dg=1
'dg=pow(10,dg-1)
int dg
if keystate(VK_SHIFT)
dg=10
else
dg=1
endif
' '
select lastkey
case VK_PRIOR 'PGUP
dat(y,x)=str(val(dat[y,x))+dg)
case VK_NEXT 'PGDN
dat(y,x)=str(val(dat[y,x))-dg)
case VK_UP
cy--
if cy<1
cy=ubound(dat,1)
endif
case VK_DOWN
cy++
if cy>ubound(dat,1)
cy=1
endif
case 9 'tab
if GetAsyncKeyState(VK_SHIFT)=0
cx++
if cx>ubound(dat,2)
cx=1
endif
else 'left
cx--
if cx<1
cx=ubound(dat,2)
endif
endif
end select
if cn>0
cx++
if cx>ubound(dat,2)
cx=1
endif
elseif cn<0
cx--
if cx<1
cx=ubound(dat,2)
endif
endif
cpick=cy*10+cx
picked=cpick
lastkey=0
lastchar=0
else 'not picked
'DATA DISPLAY
move 0,0,-.01
'color .2,.6,.3
'PutBoxArea 3,1
move 0.2,0.2,.01
color .8,.8,.6
print dat[y,x]
endif
endif
PopState
next 'x
gtot+=xtot
PushState
move x*4,-y*2
color .9,.9,.6
print xtot
PopState
next 'y
'COL TOTALS
picklabel 0
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4,-y*2
color .9,.9,.6
print ytot[x]
PopState
next 'col totals
PushState
move x*4,-y*2
color .9,.9,.6
print gtot
PopState
scale 1/1.5
'printl str(picked)
'
end procedure
EndScript
Hi Charles good morning
It's possible to make also a calculation for this little OpenGL example ?
Add+ and Substraction- Works But No multiplication
Uses consoleG
function irnd(int z1, z2) as int
================================
mov eax,z2
sub eax,z1
inc eax
imul edx,Seed,0x8088405
inc edx
mov Seed,edx 'store new seed
mul edx 'multiply eax by edx
return edx+z1
end Function
redim string dat[3,3] static 'dat[5,5] static
redim int ytot[3,1] static '[5,1]
'
procedure main()
================
sys a,i,p
static string ins
static string s
if opening
'INTIAL EXAMPLE DATA
int x,y
for y=lbound(dat,1) to ubound(dat,1)
for x=lbound(dat,2) to ubound(dat,2)
dat[y,x]=str irnd(0,99)
next
next
'
endif
'
if closing
del ytot
del dat
'mbox "closed"
exit procedure
endif
cls .10,.10,.20
'
'GRID INPUTS
------------
scale 1.5
int x,y
pushstate
move 4,-0.25
scale 1.5
print "Calculations"
popstate
move 0,-2
'
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4
print "Col " chr(x+64)
PopState
next
PushState
move x*4
print "Total"
PopState
'
for y=lbound(dat,1) to ubound(dat,1)
PushState
move 1, -y*2
print "Row" str(y)
PopState
next
PushState
move 1, -y*2
print "Total"
PopState
'
int v,v2
int gtot=0
for x=lbound(dat,2) to ubound(dat,2)
ytot[x]=0
next
'
for y=lbound(dat,1) to ubound(dat,1)
int xtot=0
for x=lbound(dat,2) to ubound(dat,2)
' add go ------------ //
v=val(dat[y,x]) 'add
xtot+=v 'xtot*=v ------------ multiply doesnt work
ytot[x]+=v 'ytot[x]* ------------ multiply doesnt work
' add go ------------ //
PushState
move x*4,-y*2
if pick
'MARK PICKING AREA
picklabel y*10+x
move 0,0,-.01
PutBoxArea 3,1
else 'not pick
if picked=y*10+x
'DATA EDITING
color 0.9,.9,0.9
a=input dat[y,x]
'print "a: "+a ' first cell top left
lastkey=0
lastchar=0
else 'not picked
'DATA DISPLAY
move 0,0,-.01
color .2,.6,.3
PutBoxArea 3,1
move 0.2,0.2,.01
color .8,.8,.6
print dat[y,x]
endif
endif
PopState
next 'x
'----------------------- // add
'gtot+=xtot
gtot+=xtot
'gtot*=xtot multiply
'----------------------- // add
PushState
move x*4,-y*2
color .9,.9,.6
print "xtot " + xtot
PopState
next 'y
'COL TOTALS
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4,-y*2
color .9,.9,.6
print ytot[x]
PopState
next 'col totals
PushState
move x*4,-y*2
color .9,.9,.6
print gtot
PopState
scale 1/1.5
'printl str(picked)
'
end procedure
EndScript
To perform multiplication in the provided OpenGL example, you need to modify the code slightly. Here's the updated code with multiplication:
Uses consoleG
function irnd(int z1, z2) as int
================================
mov eax,z2
sub eax,z1
inc eax
imul edx,Seed,0x8088405
inc edx
mov Seed,edx 'store new seed
mul edx 'multiply eax by edx
return edx+z1
end Function
redim string dat[3,3] static 'dat[5,5] static
redim int ytot[3,1] static '[5,1]
redim int xtot[3] static
procedure main()
================
sys a,i,p
static string ins
static string s
if opening
'INTIAL EXAMPLE DATA
int x,y
for y=lbound(dat,1) to ubound(dat,1)
for x=lbound(dat,2) to ubound(dat,2)
dat[y,x]=str irnd(1,9) 'Changed range to 1-9 for better visibility
next
next
'
endif
'
if closing
del ytot
del dat
del xtot
'mbox "closed"
exit procedure
endif
cls .10,.10,.20
'
'GRID INPUTS
------------
scale 1.5
int x,y
pushstate
move 4,-0.25
scale 1.5
print "Calculations"
popstate
move 0,-2
'
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4
print "Col " chr(x+64)
PopState
next
PushState
move x*4
print "Total"
PopState
'
for y=lbound(dat,1) to ubound(dat,1)
PushState
move 1, -y*2
print "Row" str(y)
PopState
next
PushState
move 1, -y*2
print "Total"
PopState
'
int v,v2
int gtot=1
for x=lbound(dat,2) to ubound(dat,2)
ytot[x]=1
next
'
for y=lbound(dat,1) to ubound(dat,1)
xtot[y]=1
for x=lbound(dat,2) to ubound(dat,2)
' multiply go ------------
v=val(dat[y,x])
xtot[y]*=v
ytot[x]*=v
' multiply go ------------
PushState
move x*4,-y*2
if pick
'MARK PICKING AREA
picklabel y*10+x
move 0,0,-.01
PutBoxArea 3,1
else 'not pick
if picked=y*10+x
'DATA EDITING
color 0.9,.9,0.9
a=input dat[y,x]
'print "a: "+a ' first cell top left
lastkey=0
lastchar=0
else 'not picked
'DATA DISPLAY
move 0,0,-.01
color .2,.6,.3
PutBoxArea 3,1
move 0.2,0.2,.01
color .8,.8,.6
print dat[y,x]
endif
endif
PopState
next 'x
'----------------------- // multiply
gtot*=xtot[y]
'----------------------- // multiply
PushState
move x*4,-y*2
color .9,.9,.6
print "xtot " + xtot[y]
PopState
next 'y
'COL TOTALS
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4,-y*2
color .9,.9,.6
print ytot[x]
PopState
next 'col totals
PushState
move x*4,-y*2
color .9,.9,.6
print gtot
PopState
scale 1/1.5
'printl str(picked)
'
end procedure
EndScript
The main changes made to the code are:
The range of random numbers generated for the initial example data is changed from 0-99 to 1-9 for better visibility of the multiplication results.
A new array xtot is introduced to store the row-wise multiplication totals.
The initialization of gtot and ytot is changed to 1 instead of 0 to handle multiplication correctly.
Inside the nested loop, the multiplication operations are performed using *= instead of +=. The values are multiplied with xtot[y] for row-wise multiplication and ytot
- for column-wise multiplication.
The row-wise multiplication total is multiplied with gtot after each row iteration.
With these modifications, the code should now perform multiplication correctly for the grid inputs. The row totals, column totals, and grand total will be displayed as the product of the corresponding values.
Here are some ideas to enhance the provided OpenGL code:Input validation: Add input validation to ensure that the user enters valid numeric values when editing the grid cells. You can display an error message or highlight the cell if an invalid input is entered.
Formatting: Improve the formatting of the displayed numbers. You can use a fixed number of decimal places or add thousand separators for better readability.
Color coding: Implement color coding for the grid cells based on their values. For example, you can use different shades of a color to represent the magnitude of the numbers.
Grid resizing: Allow the user to resize the grid dynamically. You can provide options to add or remove rows and columns, and adjust the grid layout accordingly.
Cell selection: Enhance the cell selection mechanism. Instead of using the picked variable, you can implement a more intuitive selection method, such as clicking and dragging to select a range of cells.
Keyboard navigation: Enable keyboard navigation for the grid. Allow the user to move between cells using arrow keys and edit the values using the keyboard.
Undo/Redo functionality: Implement undo and redo functionality to allow the user to revert or reapply changes made to the grid cells.
Saving and loading: Add the ability to save the grid data to a file and load it back later. This can be useful for preserving the user's work across sessions.
Tooltips: Display tooltips or cell information when the user hovers over a cell. This can provide additional details or context about the cell's value.
Animations: Incorporate animations to enhance the visual experience. For example, you can animate the changes in cell values or highlight the selected cell with a subtle animation.
Sorting: Implement sorting functionality to allow the user to sort the rows or columns based on their values. This can be helpful for analyzing the data.
Data visualization: Integrate data visualization techniques, such as charts or graphs, to represent the grid data in a more visually appealing and informative way.
Customization options: Provide customization options for the user to personalize the appearance of the grid, such as changing colors, fonts, or cell sizes.
Error handling: Improve error handling to gracefully handle any potential issues, such as division by zero or overflow/underflow conditions.
Performance optimization: Optimize the code for better performance, especially when dealing with larger grids. Consider using efficient data structures and algorithms to minimize the computation time.
These are just a few ideas to enhance the OpenGL code. The specific enhancements you choose to implement will depend on your requirements and the desired functionality of the application.
Uses consoleG
function irnd(int z1, z2) as int
================================
mov eax,z2
sub eax,z1
inc eax
imul edx,Seed,0x8088405
inc edx
mov Seed,edx 'store new seed
mul edx 'multiply eax by edx
return edx+z1
end Function
redim string dat[3,3] static 'dat[5,5] static
redim int ytot[3,1] static '[5,1]
redim int xtot[3] static
procedure main()
================
sys a,i,p
static string ins
static string s
if opening
'INTIAL EXAMPLE DATA
int x,y
for y=lbound(dat,1) to ubound(dat,1)
for x=lbound(dat,2) to ubound(dat,2)
dat[y,x]=str irnd(1,9) 'Changed range to 1-9 for better visibility
next
next
'
endif
'
if closing
del ytot
del dat
del xtot
'mbox "closed"
exit procedure
endif
cls .10,.10,.20
'
'GRID INPUTS
------------
scale 1.5
int x,y
pushstate
move 4,-0.25
scale 1.5
print "Calculations"
popstate
move 0,-2
'
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4
print "Col " chr(x+64)
PopState
next
PushState
move x*4
print "Total"
PopState
'
for y=lbound(dat,1) to ubound(dat,1)
PushState
move 1, -y*2
print "Row" str(y)
PopState
next
PushState
move 1, -y*2
print "Total"
PopState
'
int v,v2
int gtot=1
for x=lbound(dat,2) to ubound(dat,2)
ytot[x]=1
next
'
int selectedX=-1, selectedY=-1
for y=lbound(dat,1) to ubound(dat,1)
xtot[y]=1
for x=lbound(dat,2) to ubound(dat,2)
' multiply go ------------
v=val(dat[y,x])
xtot[y]*=v
ytot[x]*=v
' multiply go ------------
PushState
move x*4,-y*2
if pick or (selectedX=x and selectedY=y)
'MARK PICKING AREA
picklabel y*10+x
move 0,0,-.01
PutBoxArea 3,1
if lastkey=13 'Enter key
selectedX=x
selectedY=y
endif
else 'not pick
if selectedX=x and selectedY=y
'DATA EDITING
color 0.9,.9,0.9
a=input dat[y,x]
if not isnumeric(a)
color 1,0,0 'Red color for invalid input
print "Invalid input"
else
dat[y,x]=a
endif
lastkey=0
lastchar=0
else 'not selected
'DATA DISPLAY
move 0,0,-.01
'Color coding based on value
if v<3
color .2,.6,.3 'Green for low values
elif v<7
color .6,.6,.2 'Yellow for medium values
else
color .6,.2,.2 'Red for high values
endif
PutBoxArea 3,1
move 0.2,0.2,.01
color .8,.8,.6
print using("#.##",val(dat[y,x]))
endif
endif
PopState
next 'x
'----------------------- // multiply
gtot*=xtot[y]
'----------------------- // multiply
PushState
move x*4,-y*2
color .9,.9,.6
print using("#.##",xtot[y])
PopState
next 'y
'COL TOTALS
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4,-y*2
color .9,.9,.6
print using("#.##",ytot[x])
PopState
next 'col totals
PushState
move x*4,-y*2
color .9,.9,.6
print using("#.##",gtot)
PopState
scale 1/1.5
'printl str(picked)
'
end procedure
EndScript
The enhancements made to the code are:
Input validation: When editing a cell value, the code checks if the input is numeric using the isnumeric() function. If the input is invalid, an error message is displayed in red color.
Formatting: The using("#.##", ...) statement is used to format the displayed numbers with two decimal places.
Color coding: The code now applies color coding to the grid cells based on their values. Low values are displayed in green, medium values in yellow, and high values in red.
Keyboard navigation: The code introduces variables selectedX and selectedY to keep track of the currently selected cell. When the Enter key is pressed (lastkey=13) on a cell, it becomes the selected cell. The selected cell is highlighted, and the user can edit its value.
These enhancements provide input validation, improved formatting, visual cues through color coding, and basic keyboard navigation for cell selection and editing.
Hello theo.. please ask me before you ask the AI ��for help, that's not correct even if you want to help
Frank
Hi Frank,
The multiply does not work because the initial value of xtot is zero.
xtot+=v 'xtot*=v ------------ multiply doesnt work
ytot[x]+=v 'ytot[x]* ------------ multiply doesnt work
When multiplying horizontally, the solution is to initialize xtot with 1 instead of 0.
Similarly, for vertical multiplication, Initialize the ytot array members with 1.
Hi Theo,
This is good AI advice for turning our simple grid demo into Excel :) I hope future iterations will take on some of these suggestions. The keyboard navigation (Tab and arrow) works quite well already.
Using the AI (in this case i used #CLAUDE3) you can save a lot of typing for small Modules.
as you see you may need to do some corrections but its helpful.
Give it a try. You can find the links to all AI's here in the Forum in the AI-Section in my Subforum.
Morning Charles, how I can use this isnumeric function in a correct way cause I am Not Sure how to handle
uses console
' how to check if is_numeric is a value or string ?
'
function is_numeric2(int a) as string
if a<=1 then
return 1 ' true
else
return is_numeric2(a-1) ' false ?
end if
end function
print " is numeric2 " + is_numeric2("abc")
print " is numeric2 " + is_numeric2(100)
wait
I want to Fix Second OpenGL expl from Theo / AI
Regards Frank
Just checking the first character of the string:
uses console
' how to check if is_numeric is a value or string ?
'
function is_numeric2(string a) as int
select asc(a)
case 0x30 to 0x39 : return 1 '0 to 9
case 45 : return 1 '-
end select
end function
print " is numeric2 abc? " + is_numeric2("abc") cr
print " is numeric2 100? " + is_numeric2("100") cr
wait
Hi Charles again , I have adapted the Code perhaps you can Check this Second expl with colored Background and new Changes of Theo/AI.. the Input entry values doesn't Work anymore Rest of Code is OK seems to me
Uses consoleG
'
function isnumeric(string a) as int 'is_numeric2
select asc(a)
case 0x30 to 0x39 : return 1 '0 to 9
case 45 : return 1 '-
end select
end function
function irnd(int z1, z2) as int
================================
mov eax,z2
sub eax,z1
inc eax
imul edx,Seed,0x8088405
inc edx
mov Seed,edx 'store new seed
mul edx 'multiply eax by edx
return edx+z1
end Function
redim string dat[3,3] static 'dat[5,5] static
redim int ytot[3,1] static '[5,1]
redim int xtot[3] static
procedure main()
================
sys a,i,p
static string ins
static string s
if opening
'INTIAL EXAMPLE DATA
int x,y
for y=lbound(dat,1) to ubound(dat,1)
for x=lbound(dat,2) to ubound(dat,2)
dat[y,x]=str irnd(1,9) 'Changed range to 1-9 for better visibility
next
next
'
endif
'
if closing
del ytot
del dat
del xtot
'mbox "closed"
exit procedure
endif
cls .10,.10,.20
'
'GRID INPUTS
------------
scale 1.5
int x,y
pushstate
move 4,-0.25
scale 1.5
print "Calculations"
popstate
move 0,-2
'
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4
print "Col " chr(x+64)
PopState
next
PushState
move x*4
print "Total"
PopState
'
for y=lbound(dat,1) to ubound(dat,1)
PushState
move 1, -y*2
print "Row" str(y)
PopState
next
PushState
move 1, -y*2
print "Total"
PopState
'
int v,v2
int gtot=1
for x=lbound(dat,2) to ubound(dat,2)
ytot[x]=1
next
'
'------------------------------------------- //
int selectedX=-1, selectedY=-1
for y=lbound(dat,1) to ubound(dat,1)
xtot[y]=1
for x=lbound(dat,2) to ubound(dat,2)
' multiply go ------------
v=val(dat[y,x])
xtot[y]*=v
ytot[x]*=v
' multiply go ------------
PushState
move x*4,-y*2
if pick or (selectedX=x and selectedY=y)
'MARK PICKING AREA
picklabel y*10+x
move 0,0,-.01
PutBoxArea 3,1
if lastkey=13 'Enter key
selectedX=x
selectedY=y
endif
else 'not pick
if selectedX=x and selectedY=y
'DATA EDITING
color 0.9,.9,0.9
'------------------------------ input doesnt work here ---- //
a=input dat[y,x]
print "a: "+a ' first cell top left
if not isnumeric(a)
color 1,0,0 'Red color for invalid input
print "Invalid input"
else
dat[y,x]=a
endif
lastkey=0
lastchar=0
else 'not selected
'------------------------------ input doesnt work here ---- //
' color added
'DATA DISPLAY
move 0,0,-.01
'Color coding based on value
if v<3
color .2,.6,.3 'Green for low values
elseif v<7
color .6,.6,.2 'Yellow for medium values
else
color .6,.2,.2 'Red for high values
endif
'------------------------------------- //
PutBoxArea 3,1
move 0.2,0.2,.01
color .8,.8,.6
print dat[y,x]
'print "#.##", val(dat[y,x])
endif
endif
PopState
next 'x
'----------------------- // multiply
gtot*=xtot[y]
'----------------------- // multiply
PushState
move x*4,-y*2
color .9,.9,.6
print "xtot " + xtot[y]
'print "#.##" + xtot[y]
PopState
next 'y
'--------------------------------------- //
'COL TOTALS
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4,-y*2
color .9,.9,.6
print ytot[x]
PopState
next 'col totals
PushState
move x*4,-y*2
color .9,.9,.6
print gtot
PopState
scale 1/1.5
'printl str(picked)
'
end procedure
EndScript
Hi Frank,
I've restored the core section. The best way is to introduce your changes step by step, testing each time:
Uses consoleG
'
function isnumeric(string a) as int 'is_numeric2
select asc(a)
case 0x30 to 0x39 : return 1 '0 to 9
case 45 : return 1 '-
end select
end function
function irnd(int z1, z2) as int
================================
mov eax,z2
sub eax,z1
inc eax
imul edx,Seed,0x8088405
inc edx
mov Seed,edx 'store new seed
mul edx 'multiply eax by edx
return edx+z1
end Function
redim string dat[3,3] static 'dat[5,5] static
redim int ytot[3,1] static '[5,1]
redim int xtot[3] static
procedure main()
================
sys a,i,p
static string ins
static string s
if opening
'INTIAL EXAMPLE DATA
int x,y
for y=lbound(dat,1) to ubound(dat,1)
for x=lbound(dat,2) to ubound(dat,2)
dat[y,x]=str irnd(1,9) 'Changed range to 1-9 for better visibility
next
next
'
endif
'
if closing
del ytot
del dat
del xtot
'mbox "closed"
exit procedure
endif
cls .10,.10,.20
'
'GRID INPUTS
------------
scale 1.5
int x,y
pushstate
move 4,-0.25
scale 1.5
print "Calculations"
popstate
move 0,-2
'
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4
print "Col " chr(x+64)
PopState
next
PushState
move x*4
print "Total"
PopState
'
for y=lbound(dat,1) to ubound(dat,1)
PushState
move 1, -y*2
print "Row" str(y)
PopState
next
PushState
move 1, -y*2
print "Total"
PopState
'
int v,v2
int gtot=1
for x=lbound(dat,2) to ubound(dat,2)
ytot[x]=1
next
'
'------------------------------------------- //
int selectedX=-1, selectedY=-1
for y=lbound(dat,1) to ubound(dat,1)
xtot[y]=1
for x=lbound(dat,2) to ubound(dat,2)
' multiply go ------------
v=val(dat[y,x])
xtot[y]*=v
ytot[x]*=v
============================
============================
PushState
move x*4,-y*2
if pick
'MARK PICKING AREA
picklabel y*10+x
move 0,0,-.01
PutBoxArea 3,1
else 'not pick
if picked=y*10+x
'DATA EDITING
color 0.9,.9,0.9
a=input dat[y,x]
lastkey=0
lastchar=0
else 'not picked
'DATA DISPLAY
move 0,0,-.01
color .2,.6,.3
PutBoxArea 3,1
move 0.2,0.2,.01
color .8,.8,.6
print dat[y,x]
endif
endif
PopState
============================
============================
/*
' multiply go ------------
PushState
move x*4,-y*2
if pick or (selectedX=x and selectedY=y)
'MARK PICKING AREA
picklabel y*10+x
move 0,0,-.01
PutBoxArea 3,1
if lastkey=13 'Enter key
selectedX=x
selectedY=y
endif
else 'not pick
if selectedX=x and selectedY=y
'DATA EDITING
color 0.9,.9,0.9
'------------------------------ input doesnt work here ---- //
a=input dat[y,x]
print "a: "+a ' first cell top left
if not isnumeric(a)
color 1,0,0 'Red color for invalid input
print "Invalid input"
else
dat[y,x]=a
endif
lastkey=0
lastchar=0
else 'not selected
'------------------------------ input doesnt work here ---- //
' color added
'DATA DISPLAY
move 0,0,-.01
'Color coding based on value
if v<3
color .2,.6,.3 'Green for low values
elseif v<7
color .6,.6,.2 'Yellow for medium values
else
color .6,.2,.2 'Red for high values
endif
'------------------------------------- //
PutBoxArea 3,1
move 0.2,0.2,.01
color .8,.8,.6
print dat[y,x]
'print "#.##", val(dat[y,x])
endif
endif
PopState
*/
next 'x
'----------------------- // multiply
gtot*=xtot[y]
'----------------------- // multiply
PushState
move x*4,-y*2
color .9,.9,.6
print "xtot " + xtot[y]
'print "#.##" + xtot[y]
PopState
next 'y
'--------------------------------------- //
'COL TOTALS
for x=lbound(dat,2) to ubound(dat,2)
PushState
move x*4,-y*2
color .9,.9,.6
print ytot[x]
PopState
next 'col totals
PushState
move x*4,-y*2
color .9,.9,.6
print gtot
PopState
scale 1/1.5
'printl str(picked)
'
end procedure
EndScript
Hi Charles First of all thx for correction :)
I'm actually doing it in a similar way, only this time I'm building Code example from the back to the front and at the end the Input Control didnt Work .. Often I divide Code example in three four parts with my checking Control Set If Print 1 OK and so on...
I know that AI's are producing Error Messages and they are doing mistakes but otherside I See Always chances to improve Code examples..
But in this Case I am more disappointed of improvements the AI announced ;)
Regards nice Weekend , frank
Hallo Frank, which #AI?
Lastly people found that AMAZON's AI consists of 2500 poor Indians in a Call-Center Room answering silly questions as good as they an.
So don't talk generally about #AI tell us which one.
Did you Try #Mistral?
Hello theo.. you have sent the Code of AI Claude AS you mentioned already and its in my eyes Not so good for using this example cause a Lot of Errors occured and you must adept twice. I supposed you must give detailed Infos about Code language to the AI to get a useful reply.
Myself I took and asked Chat gtp two month ago for help to translate a french Song to German and that was OK but Same Problem I must correct IT too. Mistral I didnt know. And I didnt want to use IT. I am learning more about programming by doing mistakes and I am Not a Professional programmer so I dont have Higher skills to adept IT all for my favourite Basic language or other Software package. For some Users it May be a benefit to ASK an AI for Help or learning a new Basic language or quite other daily Things but I have much more a distant and critical view at These intelligent Machines ;)