ristoi General User


Joined: 25 Aug 2009 Posts: 25 Location: Järvenpää
|
Posted: Wed Jul 07, 2010 10:40 am Post subject: Function for input of value with helpful model information |
|
|
In different location there is different desimal and thousand separators and date & currency formats. I create sAnna function for input with some helpful information of those things and the variable.
For example it can be used to look at appearance currency format of any country if it is defined in Openoffice.
sAnna is for those situations. sAnna is in reality InputBox with some ready made automatic text. It returns users accepted value of copy of variable (argument sParam) as a string.
Cancel button returns empty value.
User can see if old/current value is valid as number or valid as date and (s)he can see correct format of the date and optionally format of currency or scientific value or floating number.
Implemented languages: fi et pl es fr de da cs
More info of language settings of sAnna is on post of same kind subroutine Titta with header "Subroutine for peeking a variable with copy of value"
I hope this can help on multilingual situations.
Regards
Risto
| Code: |
Function sAnna ( ByVal sParam as sTring, optional Selite as String, optional sMuoto2 as String)
REM Tämä sAnna-funktio esittää muuttujan ,jonka sParam-argumentti välittää) merkkijonona ja
REM palauttaa sen mahdollisesti käyttäjän muuttamana.
REM sSelite sisältää mahdollisen selitteen käyttäjälle, saa olla tyhjä, muttei puuttua
REM sMuoto2 (valinnainen) ohjaa 2. lukuesitysvihjeeksi joko Scientific- tai Currency-muodon
REM sMuoto2:n oletus on Standard
REM Lyhyesti: InputBox automaattisin lisätiedoin
REM (RJ)
REM !!! Peruuta-painike tuottaa tyhjän merkkijonon, muttei keskeytä toimintaa!!!
DIM s as String, sOtsikko as String, sSelite as String, sOhjaus as String
DIM sUs(7) as String, sT as String
DIM iK as Integer
REM Haetaan käytettävä (asiakirjan) kieli
iK = iKieli()
REM käsitellään puuttuvien argumenttien tapaukset
IF IsMissing(Selite) then
sSelite =""
else
sSelite = Selite
EndIf
If IsMissing(sMuoto2) then
sOhjaus = "Standard"
else
If Instr(sMuoto2,"Sci") OR Instr(sMuoto2,"Tie") then
sOhjaus = "Scientific"
elseif Instr(sMuoto2,"Cur") OR Instr(sMuoto2,"Val") then
sOhjaus = "Currency"
else
sOhjaus = "Standard"
EndIf
EndIf
REM sOtsikko saa tässä arvon:
sT=Choose(iK,"Päivitä arvo", "Värskenda väärtus", "Wartosc odswiez", "Actualizar el valor",_
"Actualiser la valeur", "Refresh-Wert", "Opdater værdi", "Aktualizovat hodnoty", "Update value", "?", "?")
sOtsikko= sT & " | "_
& Format(Now(), "Standard") & " | "_
& Format(-123456.789, sOhjaus) & " |"
sT=Choose(iK, "On nyt: ", "On nüüd: ", "To jest teraz: ", "Ahora es: ", "Il est maintenant : ",_
"Es ist jetzt: ", "Det er nu: ", "Nyní je: ", "Is now: ", "?")
sUs(2) = sT
sUs(3) = "[" & sParam & "]"
If sParam<>"" then
If IsNumeric(sParam) then
sT=Choose(iK, "kelpaa luvuksi", "kehtiv arvuks", "wazna postacia", "una figura válida",_
"un chiffre valide", "eine gültige Zahl", "et gyldigt tal", "platný údaj", "valid as a number", "?")
sUs(4) = ", " & sT
EndIf
If IsDate(sParam) then
sT=Choose(iK, "kelpaa päivämääräksi", "kehtiv kuupäev", "wazne daty", "una fecha válida",_
"une date valide", "ein gültiges Datum", "en gyldig dato", "platné datum", "valid as a date", "?")
sUs(5) = ", " & sT
EndIf
else
REM iK-> ------1-------2--------3-------4--------5-------6-------7-------8---------9------10...
sT=Choose(iK, "tyhjä", "tühi", "pusty", "vacío", "vide", "leer", "tom", "prázdný", "empty", "?")
sUs(3)=sUs(3) & " (=" & sT & ")"
EndIf
s=Join(sUs(),"")
REM Muodostetaan selite
s = sSelite & Chr(13) & Chr(13) & s
sAnna = InputBox(s, sOtsikko, sParam, -8000,320) 'Ikkunasta vasemmalle, yläreunasta vähän alas
',30000,30000 ->näytön oikea alakulma
End Function ' sAnna
|
|
|