Advertisement
Guest User

Table value skipper

a guest
Mar 14th, 2020
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. on init
  2. message("")
  3. set_ui_height_px(150)
  4. make_perfview
  5.  
  6. define table_cols := 2
  7. declare table_x := 100
  8. declare table_y := 20
  9. declare table_w := 150
  10. declare table_h := 100
  11.  
  12. declare ui_table table[table_cols](1, 4, 100) // real table
  13. declare ui_xy ?table_control[2] // an invisible xy pad overlay
  14. declare pad_y // just so we don't need to do the calculations later on again
  15.  
  16. table_control -> x := table_x
  17. table_control -> y := table_y + 3 // to make the invisible pad fit in the table
  18. table_control -> width := table_w
  19. table_control -> height := table_h - 3
  20. table_control -> picture := "transparent"
  21. table_control -> cursor_picture := "transparent_px"
  22.  
  23. table_control -> mouse_mode := 2
  24. table -> x := table_x
  25. table -> y := table_y
  26. table -> width := table_w
  27. table -> height := table_h
  28.  
  29. declare ui_label txt (1,1)
  30. end on
  31.  
  32. // Let's sprinkle the code with some magic dust!
  33. on ui_control(table_control)
  34. pad_y := real_to_int(table_control[1] * int_to_real(table_h))
  35. table[real_to_int(table_control[0] * int_to_real(table_cols))] := pad_y - pad_y mod 2 // 2 is the step size!
  36.  
  37. set_text(txt, table[0] & " " & table[1])
  38. end on
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement