![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
For some reason, I get this error "FORMS is not an object" (VFP 6). |
|
for nCount = 1 to _Screen.FormCount if Type("_Screen.Forms(nCount).Name)")="C" AND ... |
|
I have a modeless form running. Then I click on another form (mMain) that was opened previously and the modeless form goes to the background. The question is, how do I release that modeless form now? Is there no way to do it? I tried this: for nCount = 1 to _Screen.FormCount if upper(alltrim(_Screen.Forms(nCount).Name)) <> "MMAIN" _Screen.Forms(nCount).release() endif endfor For some reason, I get this error "FORMS is not an object" (VFP 6). I can however run the activate() method, but not the release() method. I want to release this modeless form very much ... David |
#3
| |||
| |||
|
|
I have a modeless form running. Then I click on another form (mMain) that was opened previously and the modeless form goes to the background. The question is, how do I release that modeless form now? Is there no way to do it? I tried this: for nCount = 1 to _Screen.FormCount if upper(alltrim(_Screen.Forms(nCount).Name)) <> "MMAIN" _Screen.Forms(nCount).release() endif endfor For some reason, I get this error "FORMS is not an object" (VFP 6). I can however run the activate() method, but not the release() method. I want to release this modeless form very much ... |
#4
| |||
| |||
|
|
caruso (AT) efn (DOT) org (David A. Caruso) wrote: I have a modeless form running. Then I click on another form (mMain) that was opened previously and the modeless form goes to the background. The question is, how do I release that modeless form now? Is there no way to do it? I tried this: for nCount = 1 to _Screen.FormCount if upper(alltrim(_Screen.Forms(nCount).Name)) <> "MMAIN" _Screen.Forms(nCount).release() endif endfor For some reason, I get this error "FORMS is not an object" (VFP 6). I can however run the activate() method, but not the release() method. I want to release this modeless form very much ... You are violating a principle here. I do not know that it has a name, but the principle is that when you find something, you find it in the last place you look for it. This is so, because once you find it, you are supposed to stop looking for it. <G The problem is that the act of releasing the form changes the value of _screen.formcount. AFAIK, loop control values are evaluated for the loop only when it starts. Say you have three forms, and the second is the one. After releasing that, there is no form three, yet there will be a third iteration. Instead, try something like: formindex=1 do while formindex<=_screen.formcount if upper(alltrim(_screen.forms(formindex).Name))<>"MM AIN" ^^ I think this should be "=". _screen.forms(formindex).release() exit endif formindex=formindex+1 enddo Sincerely, Gene Wirchenko Computerese Irregular Verb Conjugation: I have preferences. You have biases. He/She has prejudices. |
#5
| |||
| |||
|
|
On Sun, 01 Aug 2004 22:18:15 -0700, Gene Wirchenko <genew (AT) mail (DOT) ocis.net wrote: Gene, I think you hit it bang on, but I think the simplest way to deal with it is for him to change the line: For nCount = 1 to _Screen.FormCount to be For nCount = _Screen.FormCount to 1 step -1 |
#6
| |||
| |||
|
|
for nCount = 1 to _Screen.FormCount if upper(alltrim(_Screen.Forms(nCount).Name)) <> "MMAIN" _Screen.Forms(nCount).release() endif endfor |
|
lemmebe (AT) frednwilma (DOT) com wrote: On Sun, 01 Aug 2004 22:18:15 -0700, Gene Wirchenko <genew (AT) mail (DOT) ocis.net wrote: Gene, I think you hit it bang on, but I think the simplest way to deal with it is for him to change the line: For nCount = 1 to _Screen.FormCount to be For nCount = _Screen.FormCount to 1 step -1 Sure, but you will iterate through all of them. What if there is only one? I prefer to quit looking. [snipped previous] Sincerely, Gene Wirchenko Computerese Irregular Verb Conjugation: I have preferences. You have biases. He/She has prejudices. |
#7
| ||||
| ||||
|
|
On Mon, 02 Aug 2004 20:15:14 -0700, Gene Wirchenko <genew (AT) mail (DOT) ocis.net wrote: I think I may have missed something. I thought, from his original post, that the point was to release all windows _except_ "MMAIN". |
|
(His original posted code) for nCount = 1 to _Screen.FormCount if upper(alltrim(_Screen.Forms(nCount).Name)) <> "MMAIN" _Screen.Forms(nCount).release() endif endfor |
|
If so, don't you have to iterate through them all? |
|
If that was not the point of the exercise, then yes, mea culpa. |
![]() |
| Thread Tools | |
| Display Modes | |
| |