Hi,
I have a .NET form which calls a dialog "lookup" screen:
LookupScreen = NEW com.ui.LookupDialog(INPUT THIS-OBJECT,
INPUT "ProductCode",
INPUT TextEditorProductCode:text).
LookupScreen:Show().
I'm passing THIS-OBJECT as a parameter to the lookup screen's constructor in order that the lookup can pass back a value to the calling screen by calling a public method of the calling screen.
The constructor of the lookup screen:
DEFINE PRIVATE VARIABLE lvsThisCallingProgram AS com.ui.SpecialOffersTabsHalfScreen_1 NO-UNDO.
CONSTRUCTOR PUBLIC LookupDialog(lvsCallingProgram AS CLASS com.ui.SpecialOffersTabsHalfScreen_1,
lvcLookUpType AS CHARACTER,
lvcFilterText AS CHARACTER ):
THIS-OBJECT:lvsThisCallingProgram = lvsCallingProgram
The method call:
@VisualDesigner.
METHOD PRIVATE VOID uLookUpGrid_DoubleClick( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
lvsThisCallingProgram:LookupComplete("SomeValue").
RETURN.
END METHOD.
The method "LookUpComplete" is a public method in the main calling class.
Anyway, the error I get when trying to compile is:
"Cannot use NEW statement with class with com.ui.LookUpDialog because no constructor found with matching signature (13840)"
Could some tell me what I'm doing wrong or suggest a better way of doing this?
Thankyou,
Saquib.
Appearantly the THIS-OBJECT you're passing to the constructor (with the NEW statement) is not a com.ui.SpecialOffersTabsHalfScreen_1
I would use something more generic for the first parameter of your constructor.
Bronco
Hi,
Thanks for that. I tried also using a handle "THIS-OBJECT:HANDLE" with a matching HANDLE type in the constructor of the lookup screen and got a similar error.
" Parameter 1 for CONSTRUCTOR LookupDialog is not type compatible with its
definition. (12905)"
Is this a problem related to the constructor?
Thanks,
Saquib.
I would use something more generic for the first parameter of your constructor.
Preferibly of custom Interface type.
Thanks for that. I tried also using a handle "THIS-OBJECT:HANDLE" with a matching HANDLE type in the constructor of the lookup screen and got a similar error.
The "handle" property of .NET objects does not help you at all. That contains the HWND of the actual Windows OS resource for the Form (see http://msdn.microsoft.com/en-us/library/system.windows.forms.control.handle.aspx). Nothing relevant in your program. From which class are you using the constructor? What's the name of that class, what does it inherit from?
THIS-OBJECT is always of the type of the class that's using it.
The main calling class inherits a base form which inherits from Progress.Windows.Form:
"INHERITS com.ui.base.Form IMPLEMENTS com.ui.interface.IForm"
The interface is:
INTERFACE com.ui.interface.IForm:
METHOD PUBLIC VOID InitialiseForm ().
METHOD PUBLIC VOID DestroyForm ().
METHOD PUBLIC VOID DispatchMenu (INPUT sender AS System.Object, INPUT event AS System.EventArgs).
END INTERFACE.
The dialog lookup inherits from a base dialog class that inherits from com.ui.base.Form
"INHERITS com.ui.base.Form IMPLEMENTS com.ui.interface.IDialog"
The interface is:
INTERFACE com.ui.interface.IDialog:
METHOD PUBLIC VOID ShowModalDialog ():
END INTERFACE.
The main calling class inherits a base form which inherits from Progress.Windows.Form:
And the name of that class?
It's simply Form.class:
/*------------------------------------------------------------------------
File : Form
Purpose :
Syntax :
Description :
Author(s) : mallen
Created : Thu Mar 18 17:12:35 GMT 2010
Notes :
----------------------------------------------------------------------*/
USING shearings.util.*.
CLASS shearings.ui.base.Form INHERITS Progress.Windows.Form IMPLEMENTS shearings.ui.interface.IForm:
CLASS shearings.ui.base.Form INHERITS Progress.Windows.Form IMPLEMENTS shearings.ui.interface.IForm:
Then the parameter needs to be defined either as this type (shearings.ui.base.Form or the IForm interface).
If that's actually a base class, make sure that any call-back method you need is part of that class or the Interface. You should get used to strong-typing.
Hi,
Thanks for your continued help, I'm relatively new to all this :-)
I've got everything to compile by setting the dialog input type to be com.ui.base.Form:
CLASS com.ui.LookupDialog INHERITS com.ui.base.Dialog IMPLEMENTS com.ui.interface.IDialog, com.ui.interface.IForm :
DEFINE PRIVATE VARIABLE lvsThisCallingProgram AS CLASS com.ui.SpecialOffersTabsHalfScreen_1 NO-UNDO.
CONSTRUCTOR PUBLIC LookupDialog(lvsCallingProgram AS CLASS com.ui.base.Form,
lvcLookUpType AS CHARACTER,
lvcFilterText AS CHARACTER ):
I then cast the local variable thus:
THIS-OBJECT:lvsThisCallingProgram = CAST(lvsCallingProgram, com.ui.SpecialOffersTabsHalfScreen_1).
However, when it comes to the call-back:
METHOD PRIVATE VOID uLookUpGrid_DoubleClick( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
RUN lvsThisCallingProgram:LookupComplete(INPUT "Yay").
RETURN.
END METHOD.
I get this error:
"RUN lvsThisCallingProgram:LookupComplete" was not found (293).
N.B. As you can see I've added the com.ui.interface.IForm interface which now has the :LookupComplete method
Thanks,
Mark
There is no need to use the RUN statement when executing a class method.
DOH! Yes your right! I'd missed that!
Everything is now working as expected.
Many thanks for your help
Saquib.
You could have done the same thing with your original code. Just the change the THIS-OBJECT input parameter to;
CAST(THIS-OBJECT, com.ui.SpecialOffersTabsHalfScreen_1)
yes, you are correct of course.