PDA

View Full Version : Multi-line database


Bruce
10-05-2007, 05:56 PM
In the code below when adding text to the notes area I would like the text to look like this:

hello
this
is
me

Insted of this:
http://www.diginetx.com/images/not.JPG
here's the code:
function UpdateRecord(nID)

--Capture input fields to update the record.
local strWho = Input.GetText("account_Input");
local strLog = Input.GetText("login_Input");
local strPass = Input.GetText("password_Input");
local strNote = Input.GetText("notes_Input");
--Check to see that the above entries are valid

if strWho ~= "" and strLog ~= "" and strPass ~= "" and nID > 0 then

--Insert new account information
SQLite.Query(db, "UPDATE accounts SET who = "..Enclose(strWho)..", login = "..Enclose(strLog)..", pass = "..Enclose(strPass)..", notes = "..Enclose(strNote).." where ID = ".. nID, nil);


--Clear the Inputs
ClearInputs();
return 0;
else
Dialog.Message("Error", "Please provide an Account name, Login and Password before trying to Update an entry");
return nID;
end
end

How would I do this? :huh

Desolator
10-06-2007, 12:54 AM
Listboxes don't support new lines, you must manually split the string in a table and add each item in the listbox.

bule
10-06-2007, 03:05 AM
He uses an input object. I don't know, for me, multiline strings work normally.

longedge
10-06-2007, 06:39 AM
If you are using an input object and require it to return multiline values, then you have to tick the Multiline enabled property or you could set the property in code -
as in the help file -

-- Create properties table (only include items that should be changed)
tProperties = {};
tProperties.Multiline = true;

-- Set the properties of an input object
Input.SetProperties("Input1", tProperties);

Bruce
10-06-2007, 10:48 AM
Yes, sorry it is an input object. Thanks longedge, how would I apply your idea in the above code?

Desolator
10-06-2007, 02:11 PM
You right-click on the input object, open it's properties and set it as multi-line input.

longedge
10-06-2007, 03:11 PM
Yes, sorry it is an input object. Thanks longedge, how would I apply your idea in the above code?

In the properties dialogue for the input object on the settings tab, the multiline property is immediately under the "fonts" button. You have the option to enable multiline and then having done so you can specify whether you want scroll bars or not.

Personall I'd only do it in code if there were a reason to change it at some time while the app is running. You might for instance be using the same input for a number of purposes and sometimes want multiline and other times not.

Bruce
10-06-2007, 04:20 PM
You right-click on the input object, open it's properties and set it as multi-line input.
LOL duh! Ok I got it. Thanks

Bruce
10-06-2007, 08:33 PM
This was checked already. :huh
it must be somthing to do with the SQLite database. :rolleyes

Desolator
10-07-2007, 01:06 AM
Then use something like $& instead of \r\n and replace it before writing to the input.