Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Very basic form problem
Message
 
 
To
18/10/2003 17:44:01
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00840010
Message ID:
00840111
Views:
21
This message has been marked as the solution to the initial question of the thread.
If you want it to be modal you shouldn't have a scoping problem <s>.

That's because the modal form doesn't live outside the life-span of the click event.

When you run the example below (run it as a PRG), however, notice that I've made the *main* form var public. You really have the same problem there, as we were discussing before. The main form is *not* modal. To make it live outside the scope of the PRG you would have to either make it public, or make sure that its reference was available via some managing object, etc, etc, same choices we discussed earlier.
* MYPROG.PRG
PUBLIC X 

* for this test, we have to scope the *main* form 
* otherwise *it* would go away when you closed this PRG
* you see that, right?
* if not we will continue discussing this

x = CREATEOBJECT("myform")

x.show()  && your main form


DEFINE CLASS myform as Form

   ADD OBJECT mybutton as commandbutton 
   
   PROCEDURE init

      WITH THIS.mybutton
      
         .top = 50
         .left = 50
         .caption = "Drink me"
         
      ENDWITH
      
      PROCEDURE MyButton.Click
      
          y = CREATEOBJECT("form") 
          * doesn't matter what's in it:
          y.addobject("y1","label")
          y.caption = "my modal form"
          y.autocenter = .T.
          y.y1.caption = "something"
          y.y1.visible = .t.
          y.show(1) && modal
          
      
      ENDPROC


ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform