Hi l3whmg,
I don't know if I really understand your problem but it looks to me that your problems letter "A" and "B" exhibit the same root cause.
There are many ways of how a program crash but with HMG, as programmer you should take care of how you define the windows and how are you going to close it. HMG has one main application window. So from the Main Window if you started Function3/Form3 with Function88/Form88 are running it means that there some dependencies involve in there, perhaps a database or table which is closed by Function3/Form3. So when the control returns to Function88 that table is no longer there.
With regards to that closing, you have to make sure that when the function terminates or return control the routine or event that triggers the method it should find the control, table or private variables declared on that routine.
I think the best thing for you is to examine the ErrorLog.HTM and lookup the line number that triggers the error. Use crimson editor located at (
http://www.emeraldeditor.com or at
http://www.crimsoneditor.com) if your source editor doest not have line number so that you go to that specific line stated by errorlog.htm.
On your letter "B" problem, it is due to redefinition of control. You should do something like this:
function CallMoreThanOnce()
if IsWindowsDefined(Form99)
**--> do some control refresh here if you wish or call that refresh routine
** from another UDF, really it does not matter as long as on termination you can restore
** all variables, record number, alias to it current state before this function is called
** and the same is true with your other routines.
return nil
endif
define window Form99;
blah;
blah;
on release nil; // refocus your control from here and make sure to use DECLARE WINDOW ; // STATEMENT whenever necessary
on interactiveClose // prevent closing from here by returning logical .f. from UDF if you wish
end window
Form99.Center
Form99.Activate
return nil
Another thing is that, look at those HMG samples, particularly ON INIT, ON RELEASE, ON INTERACTIVECLOSE, IsWindowsDefined(), RELEASE WINDOW ALL command, Errorlog.Htm (this will be your guide to debug your code).
And remember, Harbour is not Clipper, its a 100% clipper compatible compiler and HMG is windows library. So when you program in windows, your programming approach should switch from modal approach (for dos and or console application and or command window applications) to event driven (windows).
And finally if you can post your small prototype code to mirror your problem post it in the forum so that everyone can examine your code and provide assistance if possible so that you can go ahead with your project.
Ciao,
Danny
By Google:
Hi l3whmg,
Non so se ho davvero capito il tuo problema, ma sembra a me che i vostri problemi lettera "A" e "B" mostra la stessa causa principale.
Ci sono molti modi di come un crash del programma, ma con HMG, come programmatore si dovrebbe prendere cura di come si definiscono le finestre e come hai intenzione di chiuderlo. HMG ha una finestra dell'applicazione principale. Così dalla finestra principale se hai iniziato Function3/Form3 con Function88/Form88 sono in esecuzione, ciò significa che c'è qualche dipendenze coinvolgere in là, magari un database o una tabella che è chiuso da Function3/Form3. Così, quando il controllo torna a Function88 quel tavolo non c'è più.
Per quanto riguarda che la chiusura, dovete fare in modo che quando la funzione termina o restituire il controllo di routine o di un evento che fa scattare il metodo si dovrebbe trovare il controllo, da tavola o variabili private dichiarato che la routine.
Penso che la cosa migliore per voi è quello di esaminare la ErrorLog.HTM e di ricerca il numero di riga che genera l'errore. Editor Usa cremisi trova (
http://www.emeraldeditor.com o
http://www.crimsoneditor.com) se fai il tuo editor di origine non hanno il numero di riga in modo che si vada in quella specifica linea dichiarata dal errorlog.htm.
Sulla vostra lettera "B" problema, è dovuto alla ridefinizione di controllo. Si dovrebbe fare qualcosa di simile a questa:
function CallMoreThanOnce()
if IsWindowsDefined(Form99)
**--> Fare qualche refresh di controllo qui se si desidera o chiamare la routine di aggiornamento
** Da un altro UDF, davvero non importa, purché al termine è possibile ripristinare
** Tutte le variabili, il numero di record, alias lo stato attuale prima di questa funzione è ** chiamata E lo
return nil
endif
define window Form99;
blah;
blah;
on release nil; // reimpostare il controllo da qui e assicurarsi di utilizzare DECLARE
; // finestra DICHIARAZIONE ogniqualvolta sia necessario
on interactiveclose nil // o impedire la chiusura da qui con il ritorno logica. f. da UDF se si desidera
end window
Form99.Center
Form99.Activate
return nil
Un'altra cosa è che, guarda a quei campioni HMG, in particolare su INIT, SU STAMPA, ON INTERACTIVECLOSE, IsWindowsDefined (), RELEASE finestra di comando TUTTI, Errorlog.Htm (questa sarà la vostra guida per eseguire il debug del codice).
E ricordate, Porto non è Clipper, il suo un compilatore clipper 100% compatibile e HMG è Windows biblioteca. Quindi, quando si programma in Windows, il vostro approccio di programmazione dovrebbe passare dal approccio modale (per DOS e / o applicazione di console e / o applicazioni finestra di comando) di event-driven (Windows).
E, infine, se è possibile pubblicare il tuo codice prototipo piccolo specchio il tuo problema post nel forum in modo che tutti possano esaminare il codice e fornire assistenza, se possibile, in modo che si possa andare avanti con il progetto.
Ciao,
Danny