我使用需要C代码的Delphi XE6在Android上构建了一个应用程序.但是在iOS上我无法使其工作.我怀疑这个问题与手臂/拇指状态有关,但我不确定.两个系统都没有问题从Pascal调用C代码.但是如果C代码回调一个Pascal过程,iOS会生成一个"bad system call (12)"
这是pascal代码:
function testarm(a,b:integer):integer; cdecl; external "testC.o";
Procedure testC;
Begin
testarm(1,2);
end;
function BackToPascal(a,b:integer): integer; cdecl;
Begin
result := a+b;
end;
......
exports
BackToPascal;
Run Code Online (Sandbox Code Playgroud)
这是C代码:
extern int BackToPascal(int a,int b);
extern int testarm(int a,int b)
{
int i;
i = BackToPascal(a,b);
return i+1;
}
Run Code Online (Sandbox Code Playgroud)
在android上这是我编译的方式(它正在工作):
..."arm-linux-androideabi-gcc.exe" -c test.c -o test.o -O3 -mfloat-abi=softfp -mfpu=neon -marm -march=armv7-a -mtune=cortex-a8
Run Code Online (Sandbox Code Playgroud)
在ios上:
xcrun -sdk iphoneos clang -c -arch armv7 test.c -O3 -mfpu=neon -mtune=cortex-a8 -marm -march=armv7-a -mfloat-abi=softfp
Run Code Online (Sandbox Code Playgroud)
我怀疑我的xcode设置是错误的,但我无法弄清楚原因.
当我调试,错误时调用来testC
在 …
它是一个Firemonkey组件,但是我可以看到VCL和FMX的大部分组件基础是相同的,所以如果你知道如何在VCL中分享你的知识,那么它最终可能是我案例的解决方案.
我使用TPopup作为祖先.它对我来说很方便,因为它保留在表单/框架上,我可以使用父进程的相同上下文/结构与LiveBindings连接,这对我来说非常方便.
我需要它的行为恰好是TPopup,作为一个容器.但我需要它看起来更好,并有我的特定按钮(我已经为我的软件内部创建了一些属性和自动化)
问题是我创建了一些内部控件,比如TLayouts,Tpanels和Tbuttons,看起来像这样:(空)
其中的黑色区域是我想放弃像TEdit和其他人一样的控件.
我已将所有内部创建的控件设置为Store = false,因此它不会存储在流式系统上.当我放弃一个TEdit时这样做,我得到的是这个(Tedit with aligned = top我需要这个):
但是我期待这个:
如果我更改Store = true,我可以获得正确的效果,但所有内部控件都在Structure面板上公开,每次保存表单并重新打开时,所有内容都会重复.暴露的内部组件对我来说不是问题,但重复的是,如果我关闭并打开组件10次,我会将整个内部结构复制10次.
我将尝试显示一些与组件设计相关的代码:
舱位声明:
[ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidOSX32 or pidiOSSimulator or pidiOSDevice or pidAndroid)]
TNaharFMXPopup = class(TPopup, INaharControlAdapter, INaharControl)
private
protected
FpnlMain : TPanel;
FlytToolBar : TLayout;
FbtnClose : TButton;
FbtnSave : TButton;
FbtnEdit : TButton;
FpnlClientArea : TPanel;
FlblTitle : TLabel;
procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
constructor Create:
constructor TNaharFMXPopup.Create(AOwner: TComponent);
begin
inherited;
FpnlMain := TPanel.Create(Self);
FlblTitle := TLabel.Create(Self);
FlytToolBar …
Run Code Online (Sandbox Code Playgroud) 我需要帮助试图让&符号字符显示在Delphi XE6 VCL TActionMainMenuBar中.我在Stack Overflow上遇到过类似的请求,但没有一个直接解决我遇到的问题.
在TActionManager中创建动作时,我需要一个动作的标题来阅读Network & Database
.我已经尝试在标题中使用两个&符号Network && Database
来逃避加速器无法正常工作.当我包括两个&符号时,我最终得到了Network _Database
(参见截图1).我还将ActionBar> Items> AutoHotKeys的属性设置为false,将ActionMainMenuBar> PersistentHotKeys设置为false.这样做并没有纠正我的问题.
我做过的一件事是纯粹的绝望,我认为修复它是包括四个&符号Network &&&& Database
,当跑出现时Network & Database
(见Screenshot2).但是在测试期间,如果我按Alt键打开热键并导航到菜单,则会显示操作的标题Network && Database
.我试图包括这个截图,因为我有不到10个声望点Stack Overflow限制我的帖子到两个附件.
如果有人能指出我正确的方向,如果我遗漏了一些信息,请告诉我.我已经没有关于如何解决这个问题的想法,而且在搜索Google时我也无法遇到类似问题.在此先感谢您的帮助.
我试图让Windows 8.1识别我一直在尝试构建的Delphi XE6应用程序(一个演示程序),让它认识到我的应用程序是Per-Monitor DPI识别的,纯粹是通过Manifest技术.Delphi XE6(以及所有其他类似的最新版本的Delphi)在Project Options中添加了一个易于操作的清单,我已经这样做了.
这是我使用MSDN资源确定的.manifest内容.我怀疑它可能有些不正确.
如果您想尝试此清单,请创建一个空的VCL应用程序,将此内容用作清单,然后添加代码(代码当前附加到我对此问题的答案).
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<!-- Per Monitor DPI Awareness in Windows 8.1 uses asmv3:application + asmv3:windowsSettings -->
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<!-- Dear Microsoft, Don't Lie to Me About What Version of Windows I am On -->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows Vista and Windows Server 2008 -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 and Windows Server 2008 R2 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 and …
Run Code Online (Sandbox Code Playgroud) 在古时候,我已经将转换函数WideString
到AnsiString
指定的代码页:
function WideStringToString(const Source: WideString; CodePage: UINT): AnsiString;
...
begin
...
// Convert source UTF-16 string (WideString) to the destination using the code-page
strLen := WideCharToMultiByte(CodePage, 0,
PWideChar(Source), Length(Source), //Source
PAnsiChar(cpStr), strLen, //Destination
nil, nil);
...
end;
Run Code Online (Sandbox Code Playgroud)
一切顺利.我将函数传递给unicode字符串(即UTF-16编码数据)并将其转换为a AnsiString
,同时理解AnsiString
指定代码页中所表示字符中的字节.
例如:
TUnicodeHelper.WideStringToString('??? ?ùíç? ????? fô? ??mp?? ?vê? ??? ?á?ÿ ???', 1252);
Run Code Online (Sandbox Code Playgroud)
将返回Windows-1252
编码的字符串:
The qùíçk brown fôx jumped ovêr the lázÿ dog
Run Code Online (Sandbox Code Playgroud)
注意:在从完整的Unicode字符集转换为Windows-1252代码页的有限范围期间,信息当然丢失了:
??? ?ùíç? ????? fô? ??mp?? ?vê? ??? ?á?ÿ …
在Delphi应用程序中,当您将鼠标悬停在边框图标上时,例如:
它行为不正确:
与行为正确的应用程序进行比较:
怎么修?
编辑 - Delphi 7也失败了:
在Delphi 5中:
在Delphi 4中:
我假设(即害怕)它是由ThemeServices引擎引起的; 他们可能认为不尊重用户的偏好很酷.但看起来它更基本.
Skype也失败了; 也用Delphi编写:
我终于找到了为什么它在我使用的每台Windows 10机器上都失败了; 但不适合所有人.高dpi.
将dpi设置为97(101%)或更高.
如何使用Delphi 创建"下拉"窗口?
超越这一点的一切都是研究工作; 并且与答案无关.
做一个适当的下拉需要很多部分仔细一起工作.我假设人们不喜欢这个棘手的问题,我宁愿问七个不同的问题; 每一个都解决了一小部分问题.接下来的一切都是我为解决这个看似简单的问题所做的研究工作.
请注意下拉窗口的定义特征:
这是我在WinForms中询问的同一问题的Delphi变体:
WinForms的答案是使用ToolStripDropDown class
.它是一个帮助类,可以将任何形式转换为下拉列表.
我将首先创建一个华而不实的下拉表单,作为示例:
接下来我将删除一个按钮,这将是我点击以显示下拉列表的内容:
最后,我将连接一些初始代码,以显示它在OnClick中需要的形式:
procedure TForm3.Button1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
frmPopup: TfrmPopup;
pt: TPoint;
begin
frmPopup := TfrmPopup.Create(Self);
//Show the form just under, and right aligned, to this button
pt := Self.ClientToScreen(Button1.BoundsRect.BottomRight);
Dec(pt.X, frmPopup.ClientWidth);
frmPopup.Show(Self, Self.Handle, pt);
end;
Run Code Online (Sandbox Code Playgroud)
编辑:将其更改为MouseDown而不是Click.单击不正确,因为显示下拉列表而无需单击.其中一个未解决的问题是如果用户再次按下按钮,如何 …
错误出现在ShowMessage(aServer.mc_version)
此代码的行中:
uses mantisconnect;
procedure TForm.Button1Click(Sender: TObject);
var
aServer: MantisConnectPortType;
begin
aServer := GetMantisConnectPortType;
ShowMessage('Mantis version:' + aServer.mc_version);
end;
Run Code Online (Sandbox Code Playgroud)
相同的代码适用于Delphi XE5,但是在Delphi XE6上编译时第一次触发错误(首次单击按钮),但下次有效:
The system cannot find the file specified
URL:http://www.mymantis.com/api/soap/mantisconnect.php -
SOAPAction: URL:http://www.mymantis.com/api/soap/mantisconnect.php/mc_version
Run Code Online (Sandbox Code Playgroud)
如果我再试一次(第二次点击按钮)就行了!输出:
Mantis version:1.2.9
Run Code Online (Sandbox Code Playgroud)
连接过程列表是
function GetMantisConnectPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): MantisConnectPortType;
const
defWSDL = 'http://www.mymantis.com/api/soap/mantisconnect.php?wsdl';
defURL = 'http://www.mymantis.com/api/soap/mantisconnect.php';
defSvc = 'MantisConnect';
defPrt = 'MantisConnectPort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr …
Run Code Online (Sandbox Code Playgroud) 我该如何实施IEnumerable<T>
?
假设我有一个我想要实现的类IEnumerable<T>
:
TStackoverflow<T> = class(TInterfacedObject, IEnumerable<T>)
public
{ IEnumerable<T> }
function GetEnumerator: IEnumerator<T>;
end;
var
IEnumerable<TMouse> mices = TStackoverflow<TMouse>.Create;
Run Code Online (Sandbox Code Playgroud)
我会有一个实现:
TStackoverflow<T> = class(TInterfacedObject, IEnumerable<T>)
public
{ IEnumerable<T> }
function GetEnumerator: IEnumerator<T>;
end;
function TStackoverflow<T>.GetEnumerator: IEnumerator<T>;
begin
Result := {snip, not important here};
end;
Run Code Online (Sandbox Code Playgroud)
现在,为了成为一名优秀的程序员,我会选择我的班级也支持这个IEnumerable
界面:
TStackoverflow<T> = class(TInterfacedObject, IEnumerable<T>, IEnumerable)
public
{ IEnumerable<T> }
function GetEnumerator: IEnumerator<T>;
{ IEnumerable }
function GetEnumerator: IEnumerator;
end;
function TStackoverflow<T>.GetEnumerator: IEnumerator<T>;
begin
Result := {snip, not important here}; …
Run Code Online (Sandbox Code Playgroud) 如果用户正在使用屏幕阅读器(例如Microsoft Narrator),并且他们的焦点进入文本框:
他们听到的只是:
编辑文字
同时在无障碍应用中,
辅助功能系统能够获得控件的"可访问名称":
批次分隔符.编辑文字
这通过实现IAccessible接口的窗口工作.它通过发送hWnd WM_GETOBJECT消息来获取窗口的IAccessible实现.应用程序永远不会发送此消息:
由Microsoft Active Accessibility和Microsoft UI Automation发送,以获取有关服务器应用程序中包含的可访问对象的信息.
应用程序从不直接发送此消息.Microsoft Active Accessibility发送此消息以响应对AccessibleObjectFromPoint,AccessibleObjectFromEvent或AccessibleObjectFromWindow的调用.
但是我们可以处理消息,并将IAccessible接口返回给调用者:
case Message.Msg of
WM_GETOBJECT:
begin
if DWORD(Message.LParam) = OBJID_CLIENT then
Message.Result := LResultFromObject(IAccessible, Message.WParam, FAccessible);
end;
end;
Run Code Online (Sandbox Code Playgroud)
在.NET世界中,它们围绕Edit控件的包装器公开了一种使用Control.AccessibleName属性设置TextBox 的可访问名称的方法:
Control.AccessibleName属性
获取或设置辅助功能客户端应用程序使用的控件的名称.
Run Code Online (Sandbox Code Playgroud)public string AccessibleName { get; set; }
我不知道底层的Microsoft Edit控件如何公开辅助功能.除了TCustomActionMenuBar之外,我在VCL中找不到任何对IAccessible的引用.
VCL如何公开辅助功能?
如何设置与TEdit控件关联的可访问名称? …
delphi ×10
delphi-xe6 ×10
windows ×2
ampersand ×1
c ×1
components ×1
dpi ×1
firemonkey ×1
generics ×1
ios ×1
mantis ×1
pascal ×1
shell ×1
soap ×1
unicode ×1
vcl ×1
windows-10 ×1
windows-8.1 ×1