newt3.pas 778 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. program newt3;
  2. uses newt;
  3. var
  4. form, labelC, entry, button : newtComponent;
  5. S: ansiString;
  6. P: Pchar;
  7. machaine :string;
  8. begin
  9. newtInit();
  10. newtCls();
  11. newtOpenWindow(10, 5, 40, 8, 'Entry and Label Sample');
  12. labelC := newtLabel(1, 1, 'Enter a string');
  13. p:=addr(machaine[1]);
  14. s:='Sample';
  15. entry := newtEntry(16,1,PChar(S),20,@P,NEWT_FLAG_SCROLL OR NEWT_FLAG_RETURNEXIT);
  16. button := newtButton(17, 3, 'Ok');
  17. form := newtForm(NiL, NiL, 0);
  18. newtFormAddComponents(form, labelC, entry, button, NiL);
  19. newtRunForm(form);
  20. newtFinished();
  21. writeln('Final string was:'+ strPas(P));
  22. (* We cannot destroy the form until after we've used the value
  23. from the entry widget. *)
  24. newtFormDestroy(form);
  25. end.