Hi Ed,
This is how I tried your suggesstion but failed to stop loading the second instance from Load as well as Init, AINSTANCE() always returned a 0 even if I passed THIS.CLASS or THIS.BASECLASS (I read the help and it said that AINSTANCE() expects base class as classname thus:
LOCAL laInst[1], loForm
IF !THIS.lAllowMultipleInstances THIS.lUseFormNumbers = .F. wait window THIS.BASECLASS + str(AINSTANCE(laInst, THIS.BASECLASS)) IF AINSTANCE(laInst, THIS.BASECLASS) > 0 wait window STR(ascan(laInst, THIS.CLASS)) *!* *!* loForm = goApp.oForms.GET(THIS.CLASS)
*!* IF TYPE("loForm") == "O" *!* loForm.SHOW()
RETURN .F. ENDIF ENDIF
RETURN DODEFAULT()
Please suggest.
<i><font color="#663300"><i><font color="#663300">Any thoughts on relatives "good"-ness between your suggestion and Jun's?</font></i>
Jun's solution will work when running the form inside an app, which is probably where you would want that behavior. Mine will work anywhere. As far as Bob's comment about activating the form, you could easily have that behavior in either solution.
<i><font color="#663300">You both point to the idea that CB hasn't already got this built in, which surprises me since it's so comprehensive in other ways.</font></i>
Then I would suggest that you add it into the framework yourself! Codebook is now Open Source, and anyone can add these missing pieces in whenever they want. </font></i>
Regards Bhavbhuti ©2002 Bhavbhuti Nathwani |