Owen...ActiveX problems with version 6

Started by funkitect, May 12, 2010, 03:21:03 PM

Previous topic - Next topic

funkitect

Owen,

I'm having a few problem migrating to version 6 of OpenDCL with regards to my ActiveX vsflexgrid control by ComponentOne.

1.  When using methods that return data, the data is returned embedded in a list.  For instance, when using a method that returns the index of the last child node....the index is supposed to be returned as an integer it is returned as a integer within a list.

2.  Event OnCellButtonClick never fires.  Other events seem to fire normally.

I haven't been keeping up-to-date with all the changes with this new version 6 so maybe there are changes that I am not aware of that are causing these problems.   It would be nice to update the Migration Guide to include migration to version 6.

James LeVieux

owenwengerd

I think there are only 3 or 4 people that were using ActiveX controls prior to 6, so there isn't much input to draw from. Please document what you learn so that it can be included in the migration guide (or perhaps better, a separate document).

The return list includes the new values of arguments that were passed by reference; in the past, those arguments' return values were discarded.

funkitect

OK.  The list is by design....I can live with that.  I will start a list of migration issues with ActiveX.  Can we rely that the first item on the returned list is the intended return value and the rest of the items, if they exist, are the byRef arguments?  If there are multiple byRef arguments  returned how can we tell which one is which?

Any idea why OnCellButtonClick is not firing?

James


Fred Tomke

Hi, James, I have no sample for it. Can you give one to demonstrate your problem, please?
Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Quote from: funkitect on May 13, 2010, 09:57:16 AM
Can we rely that the first item on the returned list is the intended return value and the rest of the items, if they exist, are the byRef arguments?  If there are multiple byRef arguments  returned how can we tell which one is which?

The list is always the return value followed by all ByRef arguments in order. The ByRef arguments are displayed with an apostrophe prefix in the control browser. BTW, ActiveX event handlers can now return their values to the control (it used to be discarded), so any events that use the return value could behave differently now.

I have no idea why OnCellButtonClick wouldn't fire. Does it contain any unusual arguments? Is your handler function name correct?

funkitect

Fred and Owen,

There are some subtle differences with what is going on with ActiveX events that I haven't quite figured out yet.  I did find that due to the "difference" one of my events was interfering with the OnCellButtonClick event.  I was able to clear this up by using the OnClick event instead of the OnBeforeMouseDown event.  I don't know why this fixed the problem!   I'll have to take a closer look at the byRef arguments to see if they might be the culprit...it seems very likely.  Otherwise, everything looks great in version 6 so far for me.

James

Fred Tomke

Thank you for sharing your experiences. Unfortunately, I have no experiences in using FlexGrid yet.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Quote from: funkitect on May 15, 2010, 11:14:42 AM
I don't know why this fixed the problem!

One possibility would be that whatever you returned from OnBeforeMouseDown was telling the control to cancel the "click". Take a look at that event's signature and see if the return value is meaningful.

funkitect

Owen,

I'm finally able to (and really need to) get back to this ActiveX issue.  One difference that I have found is that certain functions behave differently than in version 5.  The function below in ver 5 return a rownumber (as Integer) but now returns a list containing the row number as the only item in the list.  The documentation says that the return value for dcl_AxControl_Invoke "varies" but it seems that if a value is returned it is always returned within a list...so the return type is a list.  Correct?

(dcl_AxObject_Invoke "GetNodeRow" arg1 arg2) ;returns integer 2 in version 5
(dcl_AxObject_Invoke "GetNodeRow" arg1 arg2) ;returns list (2) in version 6

The other issue that I have found is more of a best-practice thing.  If any event is passed a "Cancel" argument, you should always return the value of cancel at the end of the event function.  If you don't and the event happens to return a non-nil value then all code triggered by the event will be cancelled as shown below:

Good practice:


(defun c:lm4grid1_OnBeforeEdit (Row Col Cancel / )
   ;....your code here....
   (if YouNeedTo (setq Cancel t)) 
   Cancel  ;Return the value of cancel
)

Bad practice:

(defun c:lm4grid1_OnBeforeEdit (Row Col Cancel / )
   ;....your code here....
   (setq x 4)  ;function returns 4 which is non-nil....cancels all your event code!

)

So basically all the all the activeX stuff works fine as far as I can tell.  I would just change the documentation for dcl_AxObject_Invoke to more clearly state what is returned

Thanks for all your help,

James LeVieux

owenwengerd

James:

 I installed the latest C1 VSFlexGrid ActiveX control, and on my system the control browser displays the GetNodeRow return value correctly as a list of 1 long. I guess you meant it should be documented that this is a change from 5.1 to 6 -- but you may be the only one affected as I don't think many were using ActiveX controls in earlier versions.

funkitect

Owen,

I see the parenthesis that you have in the Control Browser under Return Type now .... (Long).  I guess I was just not taking those parenthesis literally since the text below says that it, "Returns the number of a row's parent..." and does not specifically state that it returns a list containing the number.  This became especially misleading to me since it used to return a Long (not a list) in ver 5.  I guess we'll just have to chalk this one up as "just one of those crazy frustrating things".

Hopefully this thread will save somebody having similar problems in the future!

Thanks for your attention to this,

James