Posted to tcl by jeremy_c at Mon Sep 17 23:47:12 GMT 2007view raw

  1. namespace eval note_module {
  2. set form ""
  3. set title "Untitled"
  4. set tags ""
  5. }
  6.  
  7. proc note_module::on_save {} {
  8. puts "SAVING"
  9. }
  10.  
  11. proc note_module::initialize {} {
  12. puts "Loading note module..."
  13. mk::view layout db.note_module "id:I body"
  14. }
  15.  
  16. proc note_module::editor_form {base} {
  17. ttk::frame $base.note_module
  18. ttk::label $base.note_module.title_l -text "Title"
  19. ttk::entry $base.note_module.title -textvariable ::title
  20. ttk::label $base.note_module.tags_l -text "Tags"
  21. ttk::entry $base.note_module.tags -textvariable ::tags
  22. ttk::label $base.note_module.body_l -text "Body"
  23. text $base.note_module.body
  24. ttk::frame $base.note_module.commands
  25. ttk::button $base.note_module.commands.save -text "Save" -command note_module::on_save
  26. pack $base.note_module.commands.save -side left -padx 1 -pady 0 -expand 1 -fill x -anchor w
  27.  
  28. grid $base.note_module.title_l -row 0 -column 0 -pady 1 -padx 3 -sticky w
  29. grid $base.note_module.title -row 0 -column 1 -pady 1 -padx 3 -sticky we
  30. grid $base.note_module.tags_l -row 1 -column 0 -pady 1 -padx 3 -sticky w
  31. grid $base.note_module.tags -row 1 -column 1 -pady 1 -padx 3 -sticky we
  32. grid $base.note_module.body_l -row 2 -column 0 -pady 1 -padx 3 -sticky nw
  33. grid $base.note_module.body -row 2 -column 1 -pady 1 -padx 5 -sticky nswe
  34. grid $base.note_module.commands -row 3 -column 1 -pady 1 -padx 5 -sticky w
  35.  
  36. grid rowconfigure $base.note_module 2 -weight 1
  37. grid columnconfigure $base.note_module 1 -weight 1
  38. }