Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Canceling mouse events from a mousedown()
Message
 
 
To
22/03/2005 17:12:20
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00998164
Message ID:
00998312
Views:
22
Malcolm,

Another way to attack this would be to let the user put the form into edit mode, and then for your editable controls, set their .Visible to .f. and replicate a mimic control with the same visual elements from the raw baseclass. Then when they are done tweaking copy the altered values back to the real control and turn it visible and eliminate the mimic.

Setting something visible = .f. takes it out of the VFP event loop.
for each loControl in this.Objects
   if ( loControl.lEditable )
      thisform.AddObject( loControl.Name + "mimic", loControl.BaseClass + "LayoutEdit" )
      loControl.Visible = .f.
      with eval( "thisform." + loControl.Name + "mimic" )
         .Top = loControl.Top
         .Left = loControl.Left
         ...
         .Visible = .t.
      endwith
   endif
endfor
The CommandButtonLayoutEdit class would have all your resize/move logic coded in it. This way all your mouse drag stuff doesn't in any way get mixed up with your real event code.

You could even have this class be responsible for the visual property cloning task:
for each loControl in this.Objects
   if ( loControl.lEditable )
      thisform.AddObject( loControl.Name + "mimic", loControl.BaseClass + "LayoutEdit" )
      eval( "thisform." + loControl.Name + "mimic.VisualClone( loControl )" )
   endif
endfor
If the mimic item held a reference to the thing it was a clone of it could apply the changes back to the real control.

Reverse the above process to apply the edits. I assume your controls must save their layout information and reapply it the next time the form loads, you may be able to adapt your apply layout code to do the replication work above.

>Thank you for your idea of a single transparent shape managing mouse events for the form's underlying controls. I'm familar with Nick's variation on this technique and used it over a grid in the past. I can run with your idea from here.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform