Jump to content

XML problem


Mefisto_PL

Recommended Posts

Posted

Hello everyone ! I have a question. How to get item name ( for gridlist ) from xml file and text ( gui - edit ) when I click on item. Help me please, I search it everywhere, but I don't understand it :/. For example:

<items> 
<item name="Page1" text="Test"/> 
<item name="Page2" text="Test1"/> 
</items> 

Posted

Do you mean when you click on "pages" grid list, it'll show the "text" in a edit?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I would suggest loading all the content of the XML into a lua table, then you can easily get it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

To get all the content of the XML use:

xmlNodeGetChildren 

Then use the page name as index for the table, and use the text as value, e.g:

-- Global: 
pages = { } 
  
--Inside function: 
pages [ page ] = text 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Idk it is working and what I must do now.. :D

  
pages = { 
["Page"] = true, 
} 
  
function asdf ( ) 
for page, text in pairs ( pages ) do 
local row = guiGridListAddRow ( gridlist ) 
        guiGridListSetItemText ( gridList, row, 1, page, false, false ) 
    end 
end 
) 

///EDIT

But I want to create this with xml file :C

Posted

Well, do you have any idea on how XML works at all?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Let's say, do you have any idea on how to get the content of a XML file using Lua functions?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...