Skip to content

Commit

Permalink
Update TechniSatAPI.pas
Browse files Browse the repository at this point in the history
Minor changes.
  • Loading branch information
feuster committed Dec 15, 2019
1 parent 919ed47 commit 8197a93
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions TechniSatAPI.pas
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,16 @@ function tsapi_BtnCodeByName(ButtonName: String): Byte;
//set default result to invalid button
Result:=128;

//Check if string is not empty
if ButtonName='' then
exit;

//allow also KEY_ for BTN_
if LeftStr(UpperCase(ButtonName),4)='KEY_' then
ButtonName:=StringReplace(ButtonName, 'KEY_', 'BTN_', [rfReplaceAll, rfIgnoreCase]);

//Check if string is not empty and starts with BTN_
if (ButtonName<>'') and (LeftStr(UpperCase(ButtonName),4)<>'BTN_') then
//Check if string starts with BTN_
if LeftStr(UpperCase(ButtonName),4)<>'BTN_' then
exit;

//Read code from array
Expand All @@ -310,7 +314,6 @@ function tsapi_BtnCodeByName(ButtonName: String): Byte;
function tsapi_BtnDescByName(ButtonName: String): String;
//read button description from given button name
begin
//set default result to invalid button
Result:=tsapi_BtnDescByCode(tsapi_BtnCodeByName(ButtonName));
end;

Expand Down

0 comments on commit 8197a93

Please sign in to comment.