Description in the comments in source code.
Code: Select all
;When you try to transfer money online to another bank account, some banks offer you a secure way to do it; a coordenates card,
;which is a matrix of codes.
;So you must save this card in order to make some works via bank online.
;This program save this card info for you and answers you the coordenates content you ask for.
DataSection
Data$ "6J2","Z68","19S","G34","2UU","EYZ","255","7B2"
Data$ "4RD","N3N","3EM","HXI","NEI","1FE","3KR","97X"
Data$ "GCD","818","X16","71W","2SS","54J","T8X","LH4"
Data$ "H16","IGE","URL","BDC","SYU","YMZ","T2I","KC1"
Data$ "4SI","9YA","TXX","CRK","928","9M1","ZR8","FYT"
Data$ "J49","W8G","75E","524","X39","ST6","L9C","244"
Data$ "9Z1","142","3RV","H81","P2K","46B","12B","3RU"
Data$ "NX3","46K","X1A","L49","UXR","SA9","131","2GK"
EndDataSection
Procedure$ sortstringUnicode(s$)
If s$
Protected len.l=Len(s$),t.l,Dim chars.u(len-1),r$
CopyMemory(@s$,@chars(),len*SizeOf(unicode))
SortArray(chars(),#PB_Sort_Descending)
r$=PeekS(@chars(),len,#PB_Unicode)
FreeArray(chars.u())
ProcedureReturn r$
EndIf
ProcedureReturn ""
EndProcedure
Procedure$ sortstringAscii(s$); in case 's$' is stored in Ascci mode instead in Unicode (PB packages older than 5.50 version)
If s$
Protected len.l=Len(s$),t.l,Dim chars.a(len-1),r$
CopyMemory(@s$,@chars(),len)
SortArray(chars(),#PB_Sort_Descending)
r$=PeekS(@chars(),len,#PB_Ascii)
FreeArray(chars.a())
ProcedureReturn r$
EndIf
ProcedureReturn ""
EndProcedure
NewMap tarjcoord$()
For i.a=1 To 8
Read$ tarjcoord$("B"+Str(i))
Read$ tarjcoord$("C"+Str(i))
Read$ tarjcoord$("O"+Str(i))
Read$ tarjcoord$("D"+Str(i))
Read$ tarjcoord$("V"+Str(i))
Read$ tarjcoord$("Z"+Str(i))
Read$ tarjcoord$("L"+Str(i))
Read$ tarjcoord$("A"+Str(i))
Next
#Window_0=0
#Editor_0=0
#Texto_1=1
Procedure.b Open_Window_0()
If OpenWindow(#Window_0,259,186,10,42,"Tarjeta de coordenadas del Banco de blah blah blah de blah blah bla, RIF: blah blah bla SERIAL: 00748blah blah bla",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
StringGadget(#Editor_0,45,1,20,20,"")
StringGadget(#Texto_1,40,22,30,20,"",#PB_String_ReadOnly)
ProcedureReturn 1
EndIf
ProcedureReturn 0
EndProcedure
If Open_Window_0()
Repeat
UIEVENT.l=WaitWindowEvent()
If GetAsyncKeyState_(#VK_BACK):SetGadgetText(#Editor_0,""):UIEVENT=#PB_Event_Gadget:EndIf
Select UIEVENT
Case #PB_Event_Gadget
Select EventGadget()
Case #Editor_0
SetGadgetText(#Texto_1,tarjcoord$(sortstringUnicode(UCase(GetGadgetText(#Editor_0)))))
EndSelect
EndSelect
Until UIEVENT=#PB_Event_CloseWindow
EndIf