Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2007
    Posts
    186

    Autofill in Input?

    Guys, I want to do an Autofill in an input object based on the contents of a Listbox,
    but cant seem to pull it through..Wonder if its possible, and if so how?
    Any help or pointers would be appreciated!

    Thanks in advance...

  2. #2
    Join Date
    Jul 2002
    Location
    Just South of Reality
    Posts
    778
    SiNisTer
    This sounds doable. Post back a snippet of your code so someone can take a look at what problem you're having.

  3. #3
    Join Date
    Mar 2007
    Posts
    186
    Hi holtgrewe,
    I don't really have any code snippets yet at the moment, as it was just a thought in my head - I was actually looking for some ideas from some of you guys here, as base to start working on. I have a few ideas and I suppose that to begin with I should use a Table (from content in listbox) and string compare to compare the values (maybe on timer or on key of input)...havent really started yet but Im sure you and many others would agree that it would be pretty cool, and I do suppose that it is as you mentioned, doable in ams...
    I am gonna start working on it soon, and I shall make sure to post back aright

  4. #4
    Join Date
    Nov 2006
    Posts
    306
    You mean populate text into object related to the listbox?
    It can be done, you want it on show or on certain actions ?

    Kind regards,
    Casper

  5. #5
    Join Date
    Mar 2007
    Posts
    186
    Quote Originally Posted by usernameCasper View Post
    You mean populate text into object related to the listbox?
    It can be done, you want it on show or on certain actions ?

    Kind regards,
    Casper
    Yup - specifically what I have in mind is that when a user types into an input object, and if an instance of the text was found in listbox, it would do an autofiller - but not replace the whole text that the user has typed in, unless the user has clicked elsewhere (outside the input object for that matter), like in certain programs - I suppose windows explorer and certain browsers, and search engines would be a few examples...Hoped that was clear and wasn't confusing. Any ideas mate?

  6. #6
    Join Date
    Nov 2006
    Posts
    306
    Hey mate,

    See the attachment, it's done, it use one actionlistener in the input.
    For some guys that have a competition mentallity, I want to hear some improvements in my work now, I think you have a hard one now, if you think you can make code in less lines, I will do it from now on too, make it harder for other programmers to get a better understanding, but some guys like to exceed others, I dont mind, you want official programming challenges, PM me please and we can settle that down, I'm not the "pro" in luacom or C++, I control most of the things in most languages, feel free to PM me.

    Btw, toke me 2 min work for this, for those particulary persons...

    Sorry mate, but had to give my vision about helping others>
    Have fun !

    -Casper
    Attached Files

  7. #7
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    I did something similar with a SQL database. I ended up using two functions, one to build a table with the data and another to search for matching text.

    Code:
    --%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    --%%  looks up information in a table returned from a SQL query    %%
    --%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
    function TableLookup(strObject, tbInput)
    	-- Do I need to add a String.Lower function here for comparison?
    	local strInput = Input.GetText(strObject);
    	local strColumn = String.Mid(strObject, 3, -1);
    	nLength = String.Length(strInput);
    	if tbInput.Rows ~= 0 then
    		for i,v in tbInput.Data do
    			if strInput == String.Left(tbInput.Data[i][strColumn], nLength) then
    				strRemainder = String.Mid(tbInput.Data[i][strColumn], nLength + 1, -1);
    				strNewInput = strInput..strRemainder
    				Input.SetText(strObject, strNewInput);
    				Input.SetSelection(strObject, nLength+1, -1);
    			end
    		end
    	end
    end
    
    --%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    --%%  Builds a table of distinct information                       %%
    --%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
    function BuildTable(strObject, strTable)
    	local strColumn = String.Mid(strObject, 3, -1);
    	local tbReturn = SQLite.QueryToTable(thsdb, "SELECT DISTINCT "..strColumn.." FROM "..strTable);
    	if tbReturn then
    		return tbReturn;
    	else
    		tbReturn = {};
    		tbReturn.Rows = 0;
    		tbReturn.Data = {};
    		tbReturn.Data[1] = {};
    		tbReturn.Data[1][strColumn] = "NULL"
    		return tbReturn;
    	end
    end
    And this went into the input On Focus action

    Code:
    strOldText = Input.GetText(this);
    tbLookup = BuildTable(this, "Customers");
    And this went into the input On Key action

    Code:
    if e_Key == 9 or e_Key == 13 then
    	CheckForUpdate(this, strOldText, blnUpdate);
    elseif e_Key > 46 then
    	TableLookup(this, tbLookup);
    end
    There are other things going on with the code but what would happen is I would build a table of the distinct entries from the database and use that as the person typed to look for a match. If there was a match it would autocomplete and highlight the autofill text so the person could keep typing if they wanted or hit tab or enter.

    HTH
    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

Similar Threads

  1. Input Box Wierdness
    By Roboblue in forum AutoPlay Media Studio 6.0
    Replies: 9
    Last Post: 11-18-2005, 01:20 PM
  2. Input object loses focus after Internet
    By dthompson16 in forum AutoPlay Media Studio 5.0
    Replies: 6
    Last Post: 08-26-2004, 07:55 AM
  3. Lorne’s two great input validation scripts
    By csd214 in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 06-09-2004, 09:13 AM
  4. Function: Test Whether An Input Object Is Empty
    By Lorne in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 06-08-2004, 02:18 PM
  5. multiline input table apocalypse
    By dulux1309 in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 04-09-2004, 05:28 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