Jump to content



Photo

Print In Mathedit


  • Please log in to reply
7 replies to this topic

#1 saicotrance

saicotrance

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 03 January 2012 - 04:03 AM

I need help urgently. Anyone know how I can print a table that comes from a "for" loop in a "MATHEDIT." If you could put a small example

#2 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 05 January 2012 - 07:10 PM

You could put your data in a ClassPad matrix to emulate a datagrid. This is a modified version of CPLua 0.9E's UI Example 2 that puts the data from a 2d table in a matrix with ClassPad syntax and display it in the mathedit. Note that I wrote this from the top of my mind; you could maybe use simpler code for joining the data table:

require("ui", "string")
win = ui.window{ name="Test2", expand = true}
mth = ui.mathedit{ x=0, y=0, width=152, height=75}
win:add( mth )

-- This is your data
data = {}
data[0] = {"0",	  "Count", "Price"}
data[1] = {"Apple",  10,	  20	 }
data[2] = {"Banana", 30,	  40	 }

-- This is how you process your data
s = "["
for _,v in pairs(data) do
	s = s .. "["
	s1 = ""
	for _,c in pairs(v) do
		s1 = s1 .. "," .. tostring(c)
	end
	s = s .. string.sub(s1, 2) .. "]"
end
s = s .. "]"

mth:settext(s)
win:show(true)
ui.start()


#3 saicotrance

saicotrance

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 08 January 2012 - 07:52 PM

MicroPro thank you very much this works very well

#4 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 13 January 2012 - 08:23 PM

I was just glancing at that code.. It looks very similar to luaFX. Maybe we can port some of the less complicated CPLua programs to luaFX. Of course, not having a stylus on FX-9860 might cause some problems, but I think we could use a cursor controlled by the arrow keys to do that. The calculator would probably have to be held sideways also to simulate the ClassPad's portrait screen. But I think it might be possible. :)

#5 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 15 January 2012 - 10:53 AM

Which part looks similar to luaFX?

Yes it's lua ;) but the user interface functions (
win = ui.window{...}
,
mth = ui.mathedit{...}
as well as other ui elements) are exclusive to ClassPad because of its touch screen. However, the text and graphics functions used in games and real programs are designed decently (thanks Orwell!). Download CPLua and read its functions.txt file to see the functions.

#6 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 16 January 2012 - 03:32 PM

The UI functions could be implemented using a cursor, no (Lua libraries)? And I could probably implement them into CalGUI. :nod:

#7 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 16 January 2012 - 04:44 PM

I didn't say it's impossible to implement that on other calculators ;) but since other calcs don't have native UI controls it would need more effort.

Since fx calculator aren't natively touch-enabled, if I wanted to develop for it, I would note something about User Experience: using a keypad-controlled cursor will make the program more user-friendly, but will slow down advanced people working with programs. Smart arrangement of menus and shortcut keys makes it easier to operate a program for people who are used to pressing keys fast, while the cursor could help beginners in mastering the program. :)

#8 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 17 January 2012 - 06:50 PM

Yeah you are right. One of the bug complaint with TI touchpads is that you have to use a cursor. I'll think about it. :)

I could port the program engines though. ;)


2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users