HunT Posted March 19, 2012 Share Posted March 19, 2012 Where Wrong ? (first time with xml) function memo () myMemo = guiCreateMemo(19,58,360,275,"",false,MemoPanel) --------------------------------------------------------------------------- elseif (source == mapbott2) then -- botton open memo memo () -- work LoadText() -- work elseif (source == mapbott6) then -- botton close memo SaveText() -- work function LoadText() local mapText = xmlLoadFile("img/maptest.xml") if (mapText) then local value = xmlNodeGetValue(mapText) guiSetText(myMemo, value) end end function SaveText() xmlNodeSetValue(mapText, guiGetText(myMemo)) -- debug error xmlSaveFile(mapText) -- debug error xmlUnloadFile(mapText) -- debug error end Tnx. Link to comment
Castillo Posted March 19, 2012 Share Posted March 19, 2012 function memo () myMemo = guiCreateMemo(19,58,360,275,"",false,MemoPanel) --------------------------------------------------------------------------- elseif (source == mapbott2) then -- botton open memo memo () -- work LoadText() -- work elseif (source == mapbott6) then -- botton close memo SaveText() -- work function LoadText() local mapText = xmlLoadFile("img/maptest.xml") if (mapText) then local value = xmlNodeGetValue(mapText) guiSetText(myMemo, tostring(value)) xmlUnloadFile(mapText) end end function SaveText() local mapText = xmlLoadFile("img/maptest.xml") if (mapText) then xmlNodeSetValue(mapText, guiGetText(myMemo)) xmlSaveFile(mapText) xmlUnloadFile(mapText) end end You have the file "resourceName/img/maptest.xml" at downloaded client side folder, right? Link to comment
HunT Posted March 19, 2012 Author Share Posted March 19, 2012 Work Tnx Other Question. Why in memo with key p open the admin panel? t show the cursor for chat . . .y etc. is impossible to write PAPPATAPA in memo why open 4 times the admin panel and 2 times the cursor Link to comment
Agon Posted March 19, 2012 Share Posted March 19, 2012 Use guiSetInputMode this will disable binds while typing in memo Link to comment
Castillo Posted March 19, 2012 Share Posted March 19, 2012 You're welcome. About that, you must use guiSetInputEnabled to disable the binds and so on. Link to comment
HunT Posted March 19, 2012 Author Share Posted March 19, 2012 You're welcome.About that, you must use guiSetInputEnabled to disable the binds and so on. Oh yep work fine elseif (source == mapbott2) then memo () LoadText() guiSetInputEnabled ( true) elseif (source == mapbott6) then SaveText() guiSetInputEnabled ( false ) Tnx Again Link to comment
HunT Posted March 19, 2012 Author Share Posted March 19, 2012 Omg xml Stress me For export the map list i have : mapEdit = guiCreateEdit(140,339,117,26,"date xml",false,MemoPanel) elseif (source == mapbott7) then -- botton for create xml with name from edit exportDate = guiGetText(mapEdit) exportText = guiGetText(myMemo) local FinalText = xmlCreateFile(exportDate,exportText) xmlSaveFile ( FinalText ) xmlUnloadFile ( FinalText ) Work Fine but the name file is not .xml Link to comment
Castillo Posted March 19, 2012 Share Posted March 19, 2012 mapEdit = guiCreateEdit(140,339,117,26,"date xml",false,MemoPanel) elseif (source == mapbott7) then -- botton for create xml with name from edit exportDate = guiGetText(mapEdit) exportText = guiGetText(myMemo) local FinalText = xmlCreateFile(exportDate ..".xml",exportText) xmlSaveFile ( FinalText ) xmlUnloadFile ( FinalText ) Link to comment
HunT Posted March 21, 2012 Author Share Posted March 21, 2012 Other Problem With XML My Problem Now is The "OutPut Code" The script Work Fine: elseif (source == mapbott7) then -- Botton for create xml local exportDate = guiGetText(myEdit) -- get the text from the edit local exportText = guiGetText(myMemo) -- get the text from the memo local metaNode = xmlCreateFile(exportDate ..".xml",exportDate) -- crate the file and root with the text from edit if (metaNode) then xmlNodeSetValue(metaNode, exportText) -- set the value (text) with text from memo xmlSaveFile ( metaNode ) xmlUnloadFile ( metaNode ) image : XML : <21-03-2012>ACCEPTED :1: BADlands BLASTAround race-badlandsblastaroundDECLINED :</21-03-2012> ????? Tnx for help Link to comment
Castillo Posted March 21, 2012 Share Posted March 21, 2012 And the problem is? you're not telling us anything. Link to comment
HunT Posted March 21, 2012 Author Share Posted March 21, 2012 The problem is the output code . . .OA,OA wtOA is this? Link to comment
Castillo Posted March 21, 2012 Share Posted March 21, 2012 Must be something about the encoding, I'm not sure. Anyway, that doesn't appear on the GUI, so why is that a problem? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now