TX TextControl
Posted: Fri Aug 07, 2009 2:40 pm
by ConvertFromOldNGs
by peterb >> Wed, 23 Oct 2002 2:05:37 GMT
I am trying to get Version 9 of TX Textcontrol to work in Jade 5.2 on Windows 2000. Has anyone managed this or have experience getting the 2 to talk to each other?
problem:
tXTextControl1.buttonBarHandle := tXButtonBar1.hwnd();
I realise that the above code won't return the correct id for the button bar window - so how do you get the correct hwnd?
--
Thanks
Peter
Re: TX TextControl
Posted: Fri Aug 07, 2009 2:40 pm
by ConvertFromOldNGs
by cnwsvm1 >> Fri, 25 Oct 2002 1:50:11 GMT
We put this method on the superclass of the TX_Text_Control.
Suggest you implement this and change your code to tXTextControl1.buttonBarHandle := tXButtonBar1.getRealHwnd();
getRealHwnd():Integer updating;
/* Note - When using imported OCX controls on a Jade form, Jade creates a wrapper window. It appears that the TX text control was created with a development system that also feels the need to create a wrapper window. Sending the TX user defined messages to either of these two windows does nothing. Messages must be sent using the window handle for the actual control. The standard window::hwnd() method returns a handle to the outer wrapper window. This routine uses that window handle to step through levels of child windows to find the real window handle.
Expects the receiver to have a local variable for caching the hwnd - realHwnd:Integer
Also expects the receiver to have a method to return the internal class name - myClassName yields TX_BUTTONBAR32 or TX_RULER32 or TX_STATUSBAR32 or TX32 depending on class of receiver
External functions need to be created: getWindow(hWnd:Integer;uCmd:Integer):Integer is GetWindow in user32; getClassName(hWnd:Integer;lpClassName:String[20] output;maxCount:Integer):Integer is GetClassNameA in user32;
*/
constants
GW_CHILD = 5;
vars
theHwnd,child:Integer;
className:String[20];
nameLength:Integer;begin
// check for a cached window handle.
if realHwnd <> 0 then
return realHwnd;
endif;
theHwnd := self.hwnd();
child := call getWindow(theHwnd,GW_CHILD); // routine relies on each wrapper window only having one child
nameLength := call getClassName(theHwnd,className,className.maxLength);
while className[1:nameLength] <> myClassName and theHwnd <> 0 do
theHwnd := child;
child := call getWindow(theHwnd,GW_CHILD); // passing 0 as the window handle is safe. Will simply return 0.
nameLength := call getClassName(theHwnd,className,className.maxLength); endwhile;
// cache result and return.
realHwnd := theHwnd;
return realHwnd;
end;
Re: TX TextControl
Posted: Fri Aug 07, 2009 2:40 pm
by ConvertFromOldNGs
by peterb >> Fri, 25 Oct 2002 3:29:57 GMT
Thanks that works fine now.