Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:40 pm
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;