May 04, 2024, 12:00:35 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Call Dialog from a subroutine

Started by jerryclement, June 21, 2007, 06:36:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jerryclement

Hi, I need help with a word checker program I'm trying to complete.  It (1) loads a .txt file in an editor, (2) loads a .dic dictionary of words and (3) compares each word in editor to dictionary words. If word is NOT in dictionary, highlight in red the word and pop up a dialog to determine what to do with word by user. This is where I need help!

I tried using a modal dialog in a subroutine "WordCompare". I end up at the dialog handler and can't get back to the subroutine! I'm temporarily using a messagebox which doesn't let the user select what to do with the word not in the dictionary.

Any suggestions to help point the way??  I've attached a zip file of the program.

Thanks in advance,  Jerry C.
Jerry - Newbie from TN

sapero

June 21, 2007, 08:44:50 AM #1 Last Edit: June 21, 2007, 08:57:49 AM by sapero
First, I let you know where you made a mistake: "case @IDMENUPICK" should be right before 'select @MENUNUM', but not before 'select @controlid' :)

In subroutine WordCompare remove the messagebox, use ShowDialog, change edit_1 text to current unknown word, then wait until the user choose what to do. The button DONE should update (or not) the dictionary:
'result=MessageBox(win,CompWord$,"Select Word",@MB_OK)

SHOWDIALOG d1, win
SETCONTROLTEXT d1, EDIT_2,CompWord$
while (d1.hwnd)
wait
wend
; CompWord$ is now handled


And a small note: if the dialog is visible, the user can do anything with the main window. Disable it for a while: SHOWDIALOG d1, win
SETCONTROLTEXT d1, EDIT_2,CompWord$
declare import, EnableWindow(hwnd:int, enable:int)

EnableWindow(win.hwnd, false)
while (d1.hwnd)
wait
wend
EnableWindow(win.hwnd, true)

jerryclement

 ;D Thanks for the help, it works perfectly now!  I was not aware of the d1.hnwd code.  I'm a real newbie at EBasic. No object programming experience either.  A lot to learn and appreciate you helping.

Sincerely, Jerry C.
Jerry - Newbie from TN