Guest User

Untitled

a guest
Sep 2nd, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #include "osxstep.h"
  2.  
  3. inputbox_t *iuser, *ipass;
  4. label_t *luser, *lpass;
  5.  
  6. int quitf(void *p1, void *p2)
  7. {
  8. return (XSAppQuit());
  9. }
  10.  
  11. int buttonf(void *p1, void *p2)
  12. {
  13. static int bt=0;
  14. char name[128];
  15. widget_t *button = (widget_t *)p1;
  16. sprintf(name, "click %d", ++bt);
  17. button_set_text(button, name);
  18. printf("button press: %x, %s\n", (unsigned int)button->tag, name);
  19. return (1);
  20. }
  21.  
  22. int getinput(void *p1, void *p2)
  23. {
  24. char *user = inputbox_get_text(iuser);
  25. char *pass = inputbox_get_text(ipass);
  26.  
  27. printf("username: %s, password: %s\n", user, pass);
  28. return (1);
  29. }
  30.  
  31. int main(int argc, const char **argv)
  32. {
  33. screen_t *screen;
  34. window_t *window;
  35. button_t *button;
  36. label_t *label;
  37. box_t *box;
  38.  
  39. XSAppInit();
  40.  
  41. screen = screen_create(0,0);
  42. window = window_create(screen, 320, 240, 160, 160," window teste 1 ", 0);
  43. box = box_create(window, 295, 210, 12, 12, "box test", 0);
  44. label = label_create(box, 80, 15, 12, 14, "username: ", 0);
  45. label = label_create(box, 80, 15, 12, 34, "password: ", 0);
  46. iuser = inputbox_create(box, 80, 15, 95, 14, "user", 0);
  47. ipass = inputbox_create(box, 80, 15, 95, 34, "pass", INPUT_PASSWORD);
  48. button = button_create(box, 62, 18, 95 + 85, 32, " check ", &getinput);
  49. button = button_create(box, 62, 18, (295 - 62 - 8), (210 - 24), "quit ", &quitf);
  50.  
  51. return (XSAppMain(screen, argc, argv));
  52. }
Add Comment
Please, Sign In to add comment