Re: hstools abort mouseup question
Posted in 1995
Topics: General Discussion
In article <D25H8M.CML@usenews.nrlssc.navy.mil>, <charlie@nrlssc.navy.mil> writes: > > i have a dialog box with an enter button. > on the mouseup event of the enter button i call a function. > in this function i am validating data. > if the user did not enter a value into a field, then i want to > abort the mouseup event and go back to the dialog box. here is a short > version of my code > { this is the event script attached to the enter button } > on mouseup > call so1_enter_button_pushed(); > end mouseup; > { the function being called from the event script } > function so1_enter_button_pushed(); > if (field1 = 0) > message "you must enter a value for field 1"; > abort mouseup; > end if; > { more code that will insert a row into the database } > quit dialog box; > { call next dialog box } > end function; { so1_enter_button_pushed(); } > > the abort mouseup doesn't send me back to the dialog box, it continues > to go through the code in the function and inserts a row into the > database. what am i doing wrong? i can't use an on exit event on > field1 because the user might push the enter button without ever > going to field1. > One way in which you could do this is to let the function return an True/False value on null entry of the field and let control return to the mouseup event in order to abort the the event, as follows ... on mouseup if (NOT so1_enter_button_pushed()) abort mouseup exit script else quit dialog box end if end mouseup function so1_enter_button pushed() if (field1 = 0) message " ..... " return 0 end if { do insert here } return 1 end function --- Toby Roberts Standard disclaimers apply.