I am still working on a xplatform desktop app that uses a SQLite db and an own class of record-aware controls I use data binding to update the fields automatically when the record they are registered at changes. This works very nicely on the Mac, and for the biggest part on Windows too (after having sorted out the different GUI drawing of the windows).
But one field that reads an integer value from the db and converts it to its text representation via Integer.parse (currentlocale) gives me troubles. On the mac, it shows a year everything ok. On Windows, it shows a 2 only and once I click into it changes to 2.01. I use a format of 2099 and a mask #### to limit the text entries, and having no current Windows VM makes it difficult to debug. I know these hints are not enough to examine the problem, but maybe some of you encountered a similar behavior and could give me a hint?
correct me if If I0’m wrong,
but dosn’t parse do the opposite, convert a text to an integer?
Oh sorry, I described the wrong part that’s where I update the db. Of course it’s Integervalue.toText (currentlocale) that I use to update the text. Integervalue is of course the Integervalue I read from the appropriate db table field.
Ulrich, would be much easier if you post some code. As it is people can only guess.
I know. It’s a bit difficult because several methods, events and interface communication are running here, so here’s the main portion with a few remarks:
Sub RecordChanged(Record as RecordSet) // Record is the "new" recordset that is forwarded via an interface
// Part of the EasySQLField interface.
SetFromREcordChange = true // A boolean so the change will not try to write into the db as it would when the user changes the text
dim Result as text = raiseEvent RecordChanged(Record) // Place for a custom event handling / override. Not used here.
if result.Empty then // no custom event handling
if record <> nil then
dim newtext as text
select case Type // in this case, the type of the field is Integer
case EasySQliteFieldType.text
newtext =Record.Field(mFieldName).StringValue.ToText
case EasySQliteFieldType.Currency
mCurrencyValue = Record.Field(mFieldName).CurrencyValue
newtext = mCurrencyValue.ToText (CurrentLocale)
case EasySQliteFieldType.Integer // <- so the select goes here
mintegerValue = Record.Field(mFieldName).IntegerValue // and now the value is read from the field of Record
newtext = mintegerValue.ToText (CurrentLocale) // and converted to a text
end Select
me.text = newtext //
which now displays in the field
OldTextValue = newtext //
and buffers its value to determine if the record should be dirtied (if the user changes the text property).
else
me.text =""
OldTextValue = ""
end if
else
me.text = result
OldTextValue = Result
end if
SetFromREcordChange = false
End Sub
Found it it is the interpretation of integer.toText that is different between OS X and Windows on the Mac (at least with my settings) the text for 205 was 2015, whereas Windows made it to read 2.015. I just needed to use the integervalue again, not the text representation.