Allows Input of an Integer in a Dialog with given Caption and Prompt.Unit
QESBPCSMsgs
Declaration
Function InputInt(const Caption, Prompt: string; var L: Int64): Boolean;
Description
If the user Cancels, then the function returns False. Invalid input is returned as 0.Ensures Default Cursor is displayed, preserves state of cursor.
| Caption | Info to Display at the top of the Dialog. | 
| Prompt | Info to Display to the left of the Input Field. | 
| L | Input & Output Value to be displayed & edited. | 
Returns
True if Ok is Clicked, False if Cancel is Clicked
Category
Routines that produce Dialogs
Implementation
 
  | function InputInt (const Caption, Prompt: string;
     var L: Int64): Boolean;
var
     Hold: TCursor;
     TempS: string;
begin
     Hold := Screen.Cursor;
     Screen.Cursor := crDefault;
     try
          if L <> 0 then
               TempS := Int2EStr (L)
          else
               TempS := '';
          Result := InputQuery (Caption, Prompt, TempS);
          if Result then
          begin
               if TempS <> '' then
                    L := Str2Int (TempS)
               else
                    Result := False;
          end;
     finally
          Screen.Cursor := Hold;
     end;
End; | 
Declaration
Function InputInt(const Caption, Prompt: string; var L: LongInt): Boolean;Implementation
 
  | function InputInt (const Caption, Prompt: string;
     var L: LongInt): Boolean;
var
     Hold: TCursor;
     TempS: string;
begin
     Hold := Screen.Cursor;
     Screen.Cursor := crDefault;
     try
          if L <> 0 then
               TempS := Int2EStr (L)
          else
               TempS := '';
          Result := InputQuery (Caption, Prompt, TempS);
          if Result then
          begin
               if TempS <> '' then
                    L := Str2Int (TempS)
               else
                    Result := False;
          end;
     finally
          Screen.Cursor := Hold;
     end;
End; | 
Declaration
Function InputInt(const Caption, Prompt: string; var L: LongWord): Boolean;Implementation
 
  | function InputInt (const Caption, Prompt: string;
     var L: LongWord): Boolean;
var
     Hold: TCursor;
     TempS: string;
begin
     Hold := Screen.Cursor;
     Screen.Cursor := crDefault;
     try
          if L <> 0 then
               TempS := Int2EStr (L)
          else
               TempS := '';
          Result := InputQuery (Caption, Prompt, TempS);
          if Result then
          begin
               if TempS <> '' then
                    L := Str2Int (TempS)
               else
                    Result := False;
          end;
     finally
          Screen.Cursor := Hold;
     end;
End; | 
Declaration
Function InputInt(const Caption, Prompt: string; var L: SmallInt): Boolean;Implementation
 
  | function InputInt (const Caption, Prompt: string;
     var L: SmallInt): Boolean;
var
     Hold: TCursor;
     TempS: string;
begin
     Hold := Screen.Cursor;
     Screen.Cursor := crDefault;
     try
          if L <> 0 then
               TempS := Int2EStr (L)
          else
               TempS := '';
          Result := InputQuery (Caption, Prompt, TempS);
          if Result then
          begin
               if TempS <> '' then
                    L := Str2Int (TempS)
               else
                    Result := False;
          end;
     finally
          Screen.Cursor := Hold;
     end;
End; | 
Declaration
Function InputInt(const Caption, Prompt: string; var L: Word): Boolean;Implementation
 
  | function InputInt (const Caption, Prompt: string;
     var L: Word): Boolean;
var
     Hold: TCursor;
     TempS: string;
begin
     Hold := Screen.Cursor;
     Screen.Cursor := crDefault;
     try
          if L <> 0 then
               TempS := Int2EStr (L)
          else
               TempS := '';
          Result := InputQuery (Caption, Prompt, TempS);
          if Result then
          begin
               if TempS <> '' then
                    L := Str2Int (TempS)
               else
                    Result := False;
          end;
     finally
          Screen.Cursor := Hold;
     end;
End; | 
Declaration
Function InputInt(const Caption, Prompt: string; var L: ShortInt): Boolean;Implementation
 
  | function InputInt (const Caption, Prompt: string;
     var L: ShortInt): Boolean;
var
     Hold: TCursor;
     TempS: string;
begin
     Hold := Screen.Cursor;
     Screen.Cursor := crDefault;
     try
          if L <> 0 then
               TempS := Int2EStr (L)
          else
               TempS := '';
          Result := InputQuery (Caption, Prompt, TempS);
          if Result then
          begin
               if TempS <> '' then
                    L := Str2Int (TempS)
               else
                    Result := False;
          end;
     finally
          Screen.Cursor := Hold;
     end;
End; | 
Declaration
Function InputInt(const Caption, Prompt: string; var L: Byte): Boolean;Implementation
 
  | function InputInt (const Caption, Prompt: string;
     var L: Byte): Boolean;
var
     Hold: TCursor;
     TempS: string;
begin
     Hold := Screen.Cursor;
     Screen.Cursor := crDefault;
     try
          if L <> 0 then
               TempS := Int2EStr (L)
          else
               TempS := '';
          Result := InputQuery (Caption, Prompt, TempS);
          if Result then
          begin
               if TempS <> '' then
                    L := Str2Int (TempS)
               else
                    Result := False;
          end;
     finally
          Screen.Cursor := Hold;
     end;
End; | 
| HTML generated by Time2HELP | 
http://www.time2help.com