sstek-tips
Programmer
Hello,
This is my first post to tektips. I now have about a couple of weeks experience of foxpro and hitting blocker at every turn, but enjoying getting round them.
I am using foxpro V9.
Is there a way to create an event method, eg a click method for an object created dynamically?
I have a form with 3 dynamically created sliders and they realise on the screen quite nicely.
thisform.AddObject(_sliderName, "olecontrol", "MSComCtl2.FlatScrollBar.2")
I now need to create a click method for each of these sliders. I can get the correct object reference but the
writeMethod() gives me a runtime error "Feature is only available if the object is in design mode"
[pre]
[tt] thisform.AddObject(_sliderName, "olecontrol", "MSComCtl2.FlatScrollBar.2")
* Find the form and the correct control within
FOR _formNo = 1 TO _screen.FormCount
IF _screen.forms[_formNo].name = thisform.Name
FOR _ControlNo = 1 to _screen.forms[_formNo].controlcount
IF(_screen.forms[_formNo].controls[_ControlNo].name = _sliderName)
MESSAGEBOX("we have the conrol for " + _sliderName)
_screen.forms[_formNo].controls[_ControlNo].writeMethod("click", "lnOne = this.value")
ENDIF
ENDFOR
ENDIF
ENDFOR[/tt] [/pre]
I found this thread, it helped a little but still struggling
Thanks
This is my first post to tektips. I now have about a couple of weeks experience of foxpro and hitting blocker at every turn, but enjoying getting round them.
I am using foxpro V9.
Is there a way to create an event method, eg a click method for an object created dynamically?
I have a form with 3 dynamically created sliders and they realise on the screen quite nicely.
thisform.AddObject(_sliderName, "olecontrol", "MSComCtl2.FlatScrollBar.2")
I now need to create a click method for each of these sliders. I can get the correct object reference but the
writeMethod() gives me a runtime error "Feature is only available if the object is in design mode"
[pre]
[tt] thisform.AddObject(_sliderName, "olecontrol", "MSComCtl2.FlatScrollBar.2")
* Find the form and the correct control within
FOR _formNo = 1 TO _screen.FormCount
IF _screen.forms[_formNo].name = thisform.Name
FOR _ControlNo = 1 to _screen.forms[_formNo].controlcount
IF(_screen.forms[_formNo].controls[_ControlNo].name = _sliderName)
MESSAGEBOX("we have the conrol for " + _sliderName)
_screen.forms[_formNo].controls[_ControlNo].writeMethod("click", "lnOne = this.value")
ENDIF
ENDFOR
ENDIF
ENDFOR[/tt] [/pre]
I found this thread, it helped a little but still struggling
Thanks