Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclassing OLE control
Message
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
01660554
Message ID:
01660569
Views:
48
The suggestions on how to subclass OLE control works. So far everything works in the test mode.
Except I have not tested a case when the ActiveX is not registered. I tried to un-register this OCX but somehow it still does not produce the error. And I don't have another computer where I could test this.
Therefore my question is whether the following way to Catch the error is the right approach:
*-- In the INIT method of the VFP Toolbar (where I am instantiating the OCX ListBar control) I have the following code:
lSuccess = .T.
try 
   with this
        *-- I created a class DBF_LISTBAR subclassing the DBI Listbar OCX
	.AddObject( 'Listbar', 'dbi_listbar','dbi_listbar')
	with .listbar
	   .Height = 600  
	   .Name   = "ListBar"
	   .Width  = 110
	   .Visible = .T.
	   .WordWrap = .T.
	   .BarHeight = 20
	   .ListMargin = 40 
	   .ItemWidth = 70  
       endwith 
   endwith 
catch to oError
   *-- Actual message will be different, less technical
   messagebox("Cannot instantiate the Listbar control because OCX is not registered",48,"Problem")
   lSuccess = .F.
endtry 

if !lSuccess
   return .F.
endif 
Does the above approach make sense?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform