问题描述
我们有英文的非本地化调试TaskDialogs。这些在希伯来语系统上显示RTL:
如何强制他们显示LTR? AFAICT这将是TDF_RTL_LAYOUT的反函数。
解决方法
我无法对此进行全面测试(因为我不想将整个系统切换到RTL),但这应该可以带您找到解决方案:如果您提供了回调函数,则可以对窗口的创建做出反应,然后只需修改其样式即可。示例:
function CallbackTdi( hWindow: HWND; msg: Cardinal; wp: WPARAM; lp: LPARAM; lpRefData: Pointer ): HRESULT; stdcall;
var
iStyle: DWord;
begin
case msg of
TDN_DIALOG_CONSTRUCTED: begin // Not yet shown
iStyle:= GetWindowLong( hWindow,GWL_EXSTYLE ); // Get existing style
// Test for me: trying the opposite by forcing RTL
//SetWindowLong( hWindow,GWL_EXSTYLE,iStyle or WS_EX_RTLREADING or WS_EX_LAYOUTRTL or WS_EX_RIGHT );
// Test for you: trying to eliminate everything that can be RTL
SetWindowLong( hWindow,iStyle and not (WS_EX_RTLREADING or WS_EX_LAYOUTRTL or WS_EX_RIGHT) );
end;
TDN_BUTTON_CLICKED: result:= S_OK; // So the dialog closes
end;
end;
var
vTdc: TTaskDialogConfig;
iButton: Integer;
begin
ZeroMemory( @vTdc,SizeOf( vTdc ) );
vTdc.cbSize:= SizeOf( vTdc );
...
vTdc.pfCallback:= @CallbackTdi; // Point to our callback function
TaskDialogIndirect( @vTdc,@iButton,nil,nil );
...
end;
如果无法立即使用,请分析实际设置了哪些窗口样式-如果它们在希伯来语系统中看起来和我一样(WS_EX_CONTROLPARENT or WS_EX_WINDOWEDGE or WS_EX_DLGMODALFRAME
= $10101
,请参阅{{3 }}),我们必须更深入地研究。