私はファイルからテキストボックスに読みたいと思っています。ユーザーはさらにデータを追加することができ、それはSMSになります
どうやってやるの
私はいくつかの準備ができたコードを試しますが、常に機能しません
enter code here
-------------------------------------------------- -------------------------------
-- scence4-1.lua
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
local widget = require( "widget" )
---------------------------------------------------------------------------------
-- 実装の開始
local obj2 = display.newImage( "images/bg4-1.png")
local btn1 = display.newImage( "images/btn_send.png",151,415 )
local btn2 = display.newImage( "images/btn_cancel.png",6,415 ) btn1.id = "オブジェクトを送信"
ローカル myname = GV_Name ローカル myid = GV_ID_NO
print (myname)
print(myid)
function scene:enterScene( event )
local params = event.params
print (params.GV_Name)
print (params.GV_ID_NO)
end
local path = system.pathForFile( "data.txt", system.DocumentsDirectory )
local fh_note = io.open( path, "r" )
if fh_note then
print (path)
io.close( fh_note )
end
textBox = native.newTextBox(25, 95, 265, 305 )
print(textBox.text)
textBox:setReferencePoint(display.TopCenterReferencePoint)
--textBox.x = screenCenter
textBox.size = 16
textBox.isEditable = true
local my_text = textBox.text
-- onRelease listener for 'sendSMS' button
local function onSendSMS( event )
-- compose an SMS message (doesn't support attachments)
local options =
{
to = { "0505930118", "9876543210" },
body = my_text
}
native.showPopup("sms", options)
-- NOTE: options table (and all child properties) are optional
end
local function onbtn1Touch( event )
if event.phase == "began" then
print (my_text)
print( "Touch event began on: " .. event.target.id )
--onRelease = onSendSMS
end
return true
end
btn1:addEventListener( "touch", onSendSMS )``
return scene
enter code here