Question: how can i do a maplet? there is an error

Hi,
i am trying to built a maplet which can encode and decode.  for example i have Ceasar encryption codes and i want to built a maplet that can do it. 

you can see below one of my try: encode is working but decode didnt work :/ what should i do?

restart:
with(Maplets[Elements]):
with(StringTools):

alphabet := convert([97, 98, 99, 231, 100, 101, 102, 103, 240, 104, 253, 105, 106, 107, 108, 109, 110, 111, 246, 112, 114, 115, 254, 116, 117, 252, 118, 121, 122],bytes): 

code:= letter -> SearchText(letter,alphabet)-1:
char := i -> alphabet[i+1]:
modulus := Length(alphabet): 
shift := proc(key);
i -> (i+key) mod modulus;
end:

CaesarEnc :=()-> Action(Evaluate('cpmessage'= 'Implode(map(char,map(shift('ky'),map(code,Explode('text')))))')):

CaesarDec := () -> Action(Evaluate('cpmessage' = 'CaesarEnc(-'ky','text')')):

Caesar := Maplet(Window('title'= "Caesar Encoding And Decoding", BoxLayout['BL1']( BoxColumn('halign'=left,
BoxRow(Label['l1']("Write message: ",'width'=100,'halign'=left), TextBox['text']('background'=white,'foreground'= brown,'height'=6,'editable'=true,'width'=50)),BoxRow(Label['l2']("Key: ",'width'=100,'halign'=left), TextBox['ky']('background'=white,'foreground'= black,'height'=3,'editable'=true,'width'=50)),Button("Encode",'onclick'=CaesarEnc()), Button("Decode",'onclick'=CaesarDec()),BoxRow(Label['l3']("Text: ",'width'=100,'halign'=left), TextBox['cpmessage']("",'background'=white,'foreground'= blue,'height'=6,'editable'=false,'width'=50) ))))):
Maplets[Display](Caesar);

i need to do it for my thesis. waiting for your answers, thank you :)

Please Wait...