All pastes #618976 Raw Edit

Stuff

public text v1 · immutable
·published 2007-07-14 10:29 UTC
rendered paste body
alias cms {
  if ( $dialog(cms) ) { dialog -v cms cms }
  else { dialog -md cms cms }
}

dialog cms {
  title "Contact Management System"
  size -1 -1 163 188
  option dbu
  edit "", 1, 46 13 64 10
  edit "", 2, 46 25 64 10
  edit "", 3, 46 37 64 10, limit 16
  edit "", 4, 46 49 65 10
  edit "", 5, 46 61 65 10, autohs
  edit "", 6, 123 61 24 10
  edit "", 7, 46 73 53 10
  edit "", 8, 100 73 14 10, limit 2
  edit "", 9, 117 73 30 10
  edit "", 10, 46 91 101 62, multi return
  edit "", 23, 164 176 73 10

  button "Save", 15, 122 160 26 9, flat
  button "Drop", 17, 93 160 26 9, flat

  button "»", 19, 153 86 9 10, flat
  button "«", 20, 153 75 9 10, disable flat

  text "First Name:", 11, 8 15 29 8
  text "Last Name:", 12, 8 27 28 8
  text "Phone:", 13, 18 38 20 8
  text "Company:", 26, 11 50 25 8
  text "Street:", 25, 18 62 18 8
  text "Apt:", 30, 112 62 12 8
  text "City:", 27, 23 74 14 8
  text "State", 28, 101 83 14 8
  text "Zip Code", 29, 118 83 24 8
  text "Comments:", 14, 8 93 30 8

  box "Client Properties:", 16, 2 1 150 172
  box "Search:", 21, 164 1 97 173
  list 22, 167 9 91 162, size
  button "Search", 24, 238 176 23 9, flat
  edit "Information...", 18, 1 176 152 10, read
}


on *:dialog:cms:*:*: {
  if ( $devent == init ) { inform Initialized... }
  else if ( $devent == sclick ) {

    ;resize expand
    if ( $did == 19 ) {
      dialog -s $dname -1 -1 534 -1
      did -b $dname 19 | did -e $dname 20
    }
    ;resize close
    else if ( $did == 20 ) {
      dialog -s $dname -1 -1 327 -1
      did -b $dname 20 | did -e $dname 19
    }

    ;save
    else if ( $did == 15 ) { cycle -s }
    
    ;drop
    else if ( $did == 17 ) { }
    ;search
    else if ( $did == 24 ) { }


  }
  else if ( $devent == dclick ) {
    if ( $did == 22 ) { cycle -p $did(15).seltext 1,2,3,8,23,21 }
  }

  ;on mouseover
  else if ( $devent == mouse ) {
    if ( $did == 1 ) { inform enter first name }
    else if ( $did == 2 ) { inform enter last name }
    else if ( $did == 3 ) { inform enter contact phone number }
    else if ( $did == 4 ) { inform enter company name }
    else if ( $did == 5 ) { inform enter street address }
    else if ( $did == 6 ) { inform enter apartment number }
    else if ( $did == 7 ) { inform enter city of contact }
    else if ( $did == 8 ) { inform enter state abbreviation }
    else if ( $did == 9 ) { inform enter contact zip code }
    else if ( $did == 10 ) { inform enter comments about contact }
    else if ( $did == 23 ) { inform enter search string }
  }
}

alias -l cycle {
  if ( $mid($1,2) == p ) { did 1 $hget($2,1) }
  else if ( $mid($1,2) == s ) { }
  else if ( $mid($1,2) == d ) { }
}

alias -l inform { did -ra cms 18 $1- }