我希望使用Sender作为TObject作为我的case ...语句的选择标准
procedure TForm.ShowGUI (Sender: TObject);
begin
case sender of
ToolButton1: begin
do_something;
end;
ToolButton2: begin
///
end;
ToolButton3: begin
do_stufff_here;
end;
ToolButton3: begin
///
end;
else ;
end;
end;
Run Code Online (Sandbox Code Playgroud)
根据case语句的要求使发件人成为序数类型的技巧?
我可以使用Delphi XE2或DELPHI XE3创建适用于iOS(MAC/IPAD)的免费软件而无需访问任何iOS硬件吗?根据以下内容,已经看到了iOS硬件丰富人员的流程:
http://blogs.embarcadero.com/ao/2011/10/26/39188
在我的情况下,我只想使用DELPHI和FIREMONKEY为iOS发布我的免费程序.
我发送带有INDY 10组件的E Mails,代码如下:
try
MyNewIndyMessage.From.Address := edFrom.Text;
MyNewIndyMessage.Recipients.EMailAddresses := edTo.Text;
MyNewIndyMessage.CCList.EMailAddresses := edCC.Text;
MyNewIndyMessage.BCCList.EMailAddresses := edBCC.Text;
MyNewIndyMessage.Subject := edSubject.Text;
MyNewIndyMessage.Body := edContent.Lines;
MyIndySMTP.Send(MyNewIndyMessage);
finally
MyIndySMTP.Disconnect;
end;
Run Code Online (Sandbox Code Playgroud)
Indy smtp要求我在Message.from.address中输入一个有效的组织,比如"myname@companyX.com",我很想进入这里,然后像"这封邮件是紧急阅读"那样进行字符串.我可以在INDY SMTP组件中绕过这样的检查吗?
将图像绘制到绘图框中的函数从2个位置调用,如果从TPagecontrol页面调用调用它可以正常工作,但是如果从form.formresize(....)调用,则会对图像进行绘制,但之后立即重新绘制绘图框.变得完全白皙.不知道这个malefinction来自哪个序列---
procedure TForm.FormResize(Sender: TObject);
begin
// frist image shown and then re painted white ???
PaintImage2PaintBox(……….);
end;
procedure TForm.pgc_mainmenuChange(Sender: TObject);
begin
// works fine as expected after pagecontrol tab change
PaintImage2PaintBox(……….);
end;;
procedure PaintImage2PaintBox(……….);
begin
/// draw into a PaintBox
end;
Run Code Online (Sandbox Code Playgroud) 在我的表格上,我放置了一个TSplitter和两个面板.运行程序我可以使用这些面板之间的拆分器移动2个面板的大小.
我想通过我的源代码移动拆分器,但我的所有尝试都失败了
procedure ChangeGUILayout (....);
var
aNewValue : Integer;
begin
MySpliiter.left := aNewValue;
....
Run Code Online (Sandbox Code Playgroud) 我想创建一个函数,它应该支持TListbox或TChecklistBox作为调用参数
MyUISupportFunction ( ...... ; aListBox : TObject);
if (aListBox as TObject) is TListBox then (aListBox as TListbox).Items.Clear;
if (aListBox as TObject) is TCHeckListBox then (aListBox as TCheckListbox).Items.Clear;
Run Code Online (Sandbox Code Playgroud)
我想我可以更有效地编写在UI(TListBox和TChechecklist Box)上工作的代码
我正在用delphi编写一个通用的图形库.
下面的代码显示了TGraph和Tvertex的实现
/// TGRAPH ....
constructor TGraph<Tdata>.Create( ...);
begin
// the graph owns its vertices - by freeing of the graph one frees the vertex list!
_vertices := TObjectList < TVertex < Tdata >>
.Create(TVertex<Tdata>.createVertexComparer(), true);
_edges := TObjectList < TEdge < Tdata >>
.Create(TEdge<Tdata>.createEdgeComparer(), true);
end;
// destroy the graph and all its elemenst!
destructor TGraph<Tdata>.Free;
begin
_edges.Free;
_vertices.Free;
end;
/// Tvertex ......
class function TVertex<T>.createVertexComparer(): IComparer<TVertex<T>>;
begin
Result := TDelegatedComparer < TVertex < T >>.Create(
function(const Left, Right: …Run Code Online (Sandbox Code Playgroud) 我们使用Delphi 10 Seattle.在我们的代码中,我们使用不同的编译器指令来生成不同的exe文件,例如调试版,发行版或具有不同功能集的版本(为不同的客户禁用某些功能......)
获取exe文件的当前方式:
任何方式通过单击按钮获得此功能(更快的方法...)
什么变成了
TStatusBar.Simpletext
将程序从VCL转换为firmonkey时的属性?
我用delphi和indy 10运行一个小的电子邮件客户端版本.我收到的一些邮件有mime格式或html格式.使用当前代码,我只需将bode.lines复制到memo.lines
MyMailMemo.Lines.AddStrings
(TIdMessage(Msg.Body);
Run Code Online (Sandbox Code Playgroud)
如何复制哑剧电子邮件的内容?
我必须要找到的共享区间INTERVALL-1 = [x1.....y1]
和INTERVALL-2 := [x2 .....y2]
所有都是简单的实际值定义的间隔.Delphi语法中是否有任何内置函数或一些免费的东西,我可以自己获得共享范围而无需特殊编码?
我想避免的:
procedure Findintervall ( ...........)
begin
if x1 < x2 then
if ....
if ....
if
end;
Run Code Online (Sandbox Code Playgroud)
猜猜这可能是代码,但5个月之后难以阅读.
下面的代码示例应该评估一个字符串.
function EvaluateString(const S: Ansistring): Ansistring;
var
i, L: Integer;
begin
L := Length(S);
i:=1;
if (L > 0) and (S[i] > ' ') and (S[L] > ' ') then
.....
end;
Run Code Online (Sandbox Code Playgroud)
但如果L = 0,(S[i] > ' ')则会产生Access违规.我能在保持这种if状况的同时避免这个问题吗?
我运行一个多线程的应用程序,我想限制我的机器上的线程数量代码概念目前是这样的(它只是一个显示背后的主要想法的一个空洞)
// a List with all the threads I have
class MyTHreadList = List<TMyCalcThread>;
// a pool class, check how many threads are active
// try to start additions threads once the nr. of running THreads
// is below the max_thread_value_running
class MyTheardPool = Class
ThreadList : MyTHreadList;
StillRunningTHreads : Integer;
StartFromThreadID : Integer;
end;
var aTHreadList : MyTHreadList;
procedure MainForm.CallCreateThreadFunction( < THREAD PARAMS > );
begin
// just create but do not start here
MyTHread := TMyCalcThread.create ( < …Run Code Online (Sandbox Code Playgroud)