Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 12 of 12

Thread: Table help

  1. #1
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175

    Table help

    I'm horrible with tables, so here goes nothing....

    I need to popultae a tree object at runtime with the section names [my section] in an ini file. I'm stumped on this one.....

    Mike

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    You can try this and adjust it to your needs. What I am doing is obtaining a list of the value names (which builds a table) and then for each item in the returned table you build the tblNodeData (another table) that will create your node on the tree, then insert that object into the tree. This only builds one level and if you want more than one level you would have to adjust it accordingly.

    Code:
    tbvnames = INIFile.GetValueNames(sFilename, "my section");
    if tbvnames then
    	for i,v in tbvnames do
    		-- Initialize node data table
    		tblNodeData = {};
    		tblNodeData.Text = INIFile.GetValue(sFilename, "my section", v);
    		tblNodeData.Data = "";
    		tblNodeData.Expanded = true;
    		tblNodeData.NodeIndex = i.."";
    		--tblNodeData.ImageIndex = 1;
    		--tblNodeData.SelectedImageIndex = 2;
    		
    		-- Insert the node
    		Tree.InsertNode("Tree1", i.."",tblNodeData);
    	end
    end
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  3. #3
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    Thanks tigg ..... what am I doing wrong?

    Code:
    SAVED_CARDS = INIFile.GetSectionNames(_ProgramFilesFolder.."\\CCkeeper\\SAVED\\cards.ini");
    
    tbvnames = INIFile.GetValueNames(sFilename, SAVED_CARDS);
    if tbvnames then
    	for i,v in tbvnames do
    		-- Initialize node data table
    		tblNodeData = {};
    		tblNodeData.Text = INIFile.GetValue(sFilename, SAVED_CARDS, v);
    		tblNodeData.Data = "";
    		tblNodeData.Expanded = true;
    		tblNodeData.NodeIndex = i.."";
    		--tblNodeData.ImageIndex = 1;
    		--tblNodeData.SelectedImageIndex = 2;
    		
    		-- Insert the node
    		Tree.InsertNode("Tree1", i.."",tblNodeData);
    	end
    end
    Told you I suck at tables!

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    from what it looks like is you are trying to use a table where a string should go. If you want to step through a table you need to use a for loop. Does your ini file have multiple sections and then within each section there are multiple entries? You then need to figure out how you want it to then populate into the tree. Here is another example that might work.

    Code:
    sFilename = "AutoPlay\\Docs\\test.ini"
    SAVED_CARDS = INIFile.GetSectionNames(sFilename);
    
    if SAVED_CARDS then --verifies that the table is good
    	--clear the tree contents
    	Tree.RemoveNode("Tree1", "0");
    	for ii,vv in SAVED_CARDS do --steps through each entry
    		-- Initialize node data table
    		tblNodeData = {};
    		tblNodeData.Text = vv;
    		tblNodeData.Data = vv;
    		tblNodeData.Expanded = true;
    		tblNodeData.NodeIndex = ii.."";
    		--tblNodeData.ImageIndex = 1;
    		--tblNodeData.SelectedImageIndex = 2;
    		
    		-- Insert the node
    		Tree.InsertNode("Tree1", ii.."",tblNodeData);
    		
    		tbvnames = INIFile.GetValueNames(sFilename, vv); 
    		--vv will be replaced by each entry everytime it steps through
    		if tbvnames then --verifies that the table is good
    			--starting here we will add all the entries below the section name
    			for i,v in tbvnames do
    				-- Initialize node data table
    				tblNodeData = {};
    				tblNodeData.Text = INIFile.GetValue(sFilename, vv, v);
    				tblNodeData.Data = v;
    				tblNodeData.Expanded = true;
    				--this sets the node number to be under the ii value assigned above
    				tblNodeData.NodeIndex = ii.."."..i;
    				--tblNodeData.ImageIndex = 1;
    				--tblNodeData.SelectedImageIndex = 2;
    				
    				-- Insert the node
    				Tree.InsertNode("Tree1", ii.."."..i,tblNodeData);
    			end
    		end
    	end
    end
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  5. #5
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    ok, I'll try it. Maybe I need to change my approach? Maybe an sql database? What I'm trying to do is store multiple sections, with several values under it. The sections are populted in the tree, when the node is selected, it should display all the values in the section - via paragraph, input, etc..

  6. #6
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    ok, tried it .... good coding tigg! Where can I find good beginner info RE: tables?

    It's half the battle, it displays the section, and all the values under it.... hmm, I think I'll give the database a try. I need to be able to pull the values & use them.

    I started with the ini because I could put all the data in one file & encrypt it, but I can do that with a database too, right?

    hmmmm........

  7. #7
    Join Date
    May 2006
    Posts
    5,380
    but I can do that with a database too, right?

    yup, i would head over to tiggs site and view his video tuts if i were you, the first set of tuts focus on a small encrypted database app, thats what got me started with the sqlite plugin/encrypted database,

    theres even a sample project ( Again, Good Work Tigg )
    Open your eyes to Narcissism, Don't let her destroy your life!!

  8. #8
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    I started on TiggTV 11 which deals with tables but I have not had a chance to record the show.
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  9. #9
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    GRRAAAATE! Tigg.... I've always had so many questions about tables, looking forward to episode 11.

    Rizula, I've watched episode 1, now I just need to watch it about 12 more times & I might get it! LOL

    thanks for all the help guys

  10. #10
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    ok - another table question.

    I'm using the dialog file browse, which returns the selected file name in a table, right? How do I get the filename/path out of the tabel?

    Code:
      OPEN = Dialog.FileBrowse(true, "Locate File", _ProgramFilesFolder.."\\COMMS\\MESSAGES\\RECIEVED\\", "All Files (*.enc)|*.enc|", "", "enc", false, true);

  11. #11
    Join Date
    Nov 2006
    Posts
    233
    code to browse for file and split the path into parts and output them to paragraph object

    Code:
    --Get File Location And Store In Table "tbOpen"
    tbOpen = Dialog.FileBrowse(true, "Locate File", _ProgramFilesFolder.."\\COMMS\\MESSAGES\\RECIEVED\\", "All Files (*.enc)|*.enc|", "", "enc", false, true);
    --We Should Only Have One Entry In The Table AS Mutilple Choice Was Disabled
    --Take The First Item In tbOpen and Split The Path Into Its Relative Parts And Store In A New Table "tbSplit"
    tbSplit = String.SplitPath(tbOpen[1]);
    --Here Are All The Variables In The tbSplit Table Stored In Variables
    --Drive
    sDrive = tbSplit.Drive;
    --Folder
    sFolder = tbSplit.Folder;
    --FileName (no extension)
    sFilename = tbSplit.Filename;
    --Extension
    sExtension = tbSplit.Extension;
    
    --Output The Variables In Mutiple Lines In A Paragraph Object
    Paragraph.SetText("Paragraph1", "Drive = " .. sDrive .. "\nFolder = " .. sFolder .. "\nFileName = " .. sFilename .. "\nExtension = " .. sExtension);

  12. #12
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    thanks desrat, good code, it works, only I'm trying to open the selected file. The file will be encrypted, i.e. somehting.enc ..... when the user selects it, it will decrypt & then display the contents of the file.

Similar Threads

  1. buttons disappear
    By mgokkaya in forum AutoPlay Media Studio 6.0
    Replies: 5
    Last Post: 04-11-2008, 02:40 PM
  2. Table questions
    By Dan Ullman in forum Setup Factory 7.0
    Replies: 2
    Last Post: 03-07-2007, 10:18 AM
  3. prob getting table to combobox
    By Jonas DK in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 01-05-2007, 04:56 PM
  4. string / table compare
    By gabrielfenwich in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 01-29-2005, 11:30 PM
  5. Creating a Table of Contents
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-03-2003, 11:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts