problems with popup menus under OS 9?

Chris Sheffield revlist at cableone.net
Fri Oct 22 17:13:28 EDT 2004


Has anyone else had problems with popup menus under OS 9?  I’m having weird
and sporadic results.  I’m thinking they’re memory related, but I’m not
totally sure.  Sometimes my app will crash with error type 2, sometimes just
the app will freeze up, and sometimes the whole computer will lock up.  I’m
not sure if the problem lies in my code in the menuPick handler of the popup
button or what.  The menu is dynamically created with items read from a text
file at run-time.  The menu displays just fine, but the problem occurs
immediately after selecting a menu item and the menu disappears.

Here’s the code:

----------------------------------------------------------------------
on menuPick theItem
  global gQuestionNum, gFillInAnswers
  
  if the currentBlank of field "Fill In" is empty then -- something went
wrong in mouseDown in field
    beep
    exit menuPick
  end if
  put word 1 of the currentBlank of field "Fill In" into startChar
  put word 3 of the currentBlank of field "Fill In" into endChar
  put item 1 of the linkText of char startChar of field "Fill In" into
blankNumber
  put item 2 of the linkText of char startChar of field "Fill In" into
correctAnswer
  if "\" is in theItem then replace "\" with empty in theItem
  
  -- record the answer in a global for later use:
  put (theItem & comma & correctAnswer & comma & (theItem is correctAnswer))
into gFillInAnswers[blankNumber]
  -- update appearance of selected word
  lock screen
  set the htmlText of char startChar to endChar of fld "Fill In" to ("<font
color=" & quote & "#0000FF" & quote & \
      "><a href=" & quote & blankNumber & "," & correctAnswer & quote &
"><b>" & \
      theItem & "</b></a></font>")
  --put theItem into char startChar to endChar of field "Fill In"
  put startChar + the length of theItem - 1 into endChar -- correct for
length of chosen word
  set the backgroundColor of char startChar to endChar of field "Fill In" to
empty
  set the textStyle of char startChar to endChar of field "Fill In" to
"bold,link"
  set the textColor of char startChar to endChar of field "Fill In" to
"blue"
  set the height of field "Fill In" to the formattedHeight of field "Fill
In"
  set the top of field "Fill In" to the bottom of field "Fill In
Instructions" + 10
  -- move "Done" button only if the field has grown so much that it's
necessary:
  if the top of button "Done" < the height of field "Fill In"
  then set the top of button "Done" to the bottom of field "Fill In" + 20
  
  -- update property
  put ("uBlank" & blankNumber) into tPropName
  put ("set the " & tPropName & " of fld " & quote & "Fill In" & quote & "
to true") into tCmd
  do tCmd
  
  CheckDone
  unlock screen
end menuPick

on CheckDone
  put the customKeys of fld "Fill In" into tPropsList
  filter tPropsList with "uBlank*"
  
  repeat for each line tProp in tPropsList
    if value("the " & tProp & " of me", fld "Fill In") is false then
      exit CheckDone
    end if
  end repeat
  
  enable btn "Fill In Done"
end CheckDone
---------------------------------------------------------------------

I realize this probably won’t make much sense out of context, but can anyone
see anything obvious that I shouldn’t be doing?  I’m pulling my hair out
over this.  The same code and popup menu work fine under OS X and Windows.
The problems only occur under OS 9.  Anyone have any ideas?  I've discovered
that increasing virtual memory helps, but doesn't totally solve the problem.
Increasing the memory allocated to the app makes no difference.

Thanks,

Chris Sheffield
Software Development
Read Naturally


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.782 / Virus Database: 528 - Release Date: 10/22/2004
 



More information about the use-livecode mailing list