这有点令人困惑,但会尽力解释它.请询问您是否需要更多详细信息.
首先,我有一个叫做TPlayersLike 的课程.
TPlayers = class
Private
p : array[1..20] of TStringList;
function GetPlayer(i:integer): TStringList;
Public
Property player[i : integer] : TStringList read GetPlayer;
constructor Create; virtual;
implementation
uses
main;
{constructor}
constructor TPlayers.Create;
begin
p[1] := TStringList.Create;
p[2] := TStringList.Create;
p[3] := TStringList.Create;
p[4] := TStringList.Create;
p[5] := TStringList.Create;
p[6] := TStringList.Create;
end;
function TPlayers.GetPlayer(i: integer): TStringList;
begin
Result := p[i];
end;
Run Code Online (Sandbox Code Playgroud)
我现在必须FTherePlayers := TPlayers.Create创建这个类.我第一次像这样添加到stringlist
FTherePlayers.Player[strtoint(name2)].Add('posx='+inttostr(posL.x));
Run Code Online (Sandbox Code Playgroud)
或者取出变量
FTherePlayers.Player[1].Add('posx=15');
Run Code Online (Sandbox Code Playgroud)
这似乎没问题,但接下来我尝试更新它
FTherePlayers.Player[strtoint(ID)].Values['posx='] := xpos;
Run Code Online (Sandbox Code Playgroud)
或者取出变量
FTherePlayers.Player[1].Values['posx='] := 12; …Run Code Online (Sandbox Code Playgroud) 我正在尝试连接到mdb(访问2000)我的应用程序有1个主屏幕,有4个按钮.每个按钮都会打开一个新表格.
我需要在所有4个子表单上访问这个数据库,我是否必须为每个表单添加一个ADOConnection?我可以在主窗体上建立连接吗?或者还有更好的方法吗?
首先,我在onselect期间使用了combobox1 fill combobox2.我开始了很长的路,见下文.
procedure TFGetZoneDept.ComboBox1Select(Sender: TObject);
begin
Combobox2.Clear;
with Combobox1 do
begin
if text = '3' then
begin
with combobox2 do
begin
Add('Zone 3 depts');
Add('Zone 3 depts');
Add('Zone 3 depts');
Add('Zone 3 depts');
Add('Zone 3 depts');
Add('Zone 3 depts');
end; {with combobox2}
end; {If }
if text = '4' then
begin
with ComboBox2 do
begin
add('Zone 4 depts');
add('Zone 4 depts');
add('Zone 4 depts');
add('Zone 4 depts');
add('Zone 4 depts)';
end;{combobox2 with}
end;{IF}
if text ='1' then
begin
with …Run Code Online (Sandbox Code Playgroud) 我有一个adoQuery,并希望用结果填充列表框,但没有重复.
with Fdeptlayout.ADOQuery2 do
begin
sql.Clear;
sql.BeginUpdate;
sql.Add('SELECT');
sql.Add(' *');
sql.Add('FROM');
sql.Add(' `MList`');
sql.Add(' ORDER BY `Basic Name`');
sql.EndUpdate;
open;
end;
while not fdeptlayout.ADOquery2.EOF do
fdeptlayout.ListBox1.Items.Add(fdeptlayout.ADOQuery2['Basic Name']);
end;
Run Code Online (Sandbox Code Playgroud)
目前,这会向列表框中添加350个项目,其中包含大量重复项.这太多了.如何更改查询以从结果中删除重复项?:(任何帮助都会很棒!
我有
property Background: TPicture read FBackground write SetBackground;
Run Code Online (Sandbox Code Playgroud)
如果没有任何东西可以被赋予它,背景的价值是什么?
我试过了
if Background = NULL then
begin
...
..
...
end;
Run Code Online (Sandbox Code Playgroud) 我有4种类型的熔岩,水,黑暗和自然.我想对每一个进行查询,一次一个.目前我有
procedure TFGame.GetStartingCards;
var
ManaType :string ;
begin
Manatype := 'Nothing';
while ManaType <> 'Nature' do
begin
if ManaType = 'Dark' then
ManaType := 'Nature';
if ManaType = 'Water' then
ManaType := 'Dark';
if Manatype = 'Lava' then
Manatype := 'Water';
if Manatype = 'Nothing' then
ManaType := 'Lava' ;
with adoquery1 do
begin
close;
sql.Clear;
sql.Add('SELECT * ');
sql.Add('FROM Cards');
sql.Add('WHERE Color='''+ManaType+'''');
open;
end;
//return the result of everything for giving mana type..
end;
Run Code Online (Sandbox Code Playgroud)
但似乎是一种更好的方法,比如将每个法术力类型放入一个数组并使用该数组来提供查询.但无法让它发挥作用.所以问题是,如果我决定保留这样的话会有任何缺陷吗?
我有一个自定义组件的销毁过程' TCARD'.然后在运行时我创建一个数组
Cards: array[1..20] of TCards
Run Code Online (Sandbox Code Playgroud)
然后我做了一些事情......在程序结束时,我想要销毁阵列中的所有TC.我该怎么做或者我必须一次这样做.
cards[1].destroy;
cards[2].destroy;
....
cards[20].destroy;
Run Code Online (Sandbox Code Playgroud) 我有一个已填充的 ObjectList。然后对象的细节发生了变化。现在我需要释放 ObjectList,但当我这样做时,它也会释放列表中的对象。如何在不释放对象本身的情况下释放此列表?
示例代码:
{Gets starting cards and put them into the correct rows}
//***************************************************************************
procedure TFGame.GetStartingCards;
//***************************************************************************
const
ManaTypes : array [0..3] of string = ('Lava','Water','Dark','Nature');
var
i: integer;
z:integer;
Cards: TObjectList<Tcard>;
begin
Cards := TObjectList<TCard>.Create;
z:=0;
{add all tcards (Desgin ) to this list in order Lava,water,dark,nature }
cards.Add(cardLava1);
cards.Add(cardlava2);
cards.Add(cardlava3);
cards.Add(cardlava4);
cards.Add(cardwater1);
cards.Add(cardwater2);
cards.Add(cardwater3);
cards.Add(cardwater4);
cards.Add(carddark1);
cards.Add(carddark2);
cards.Add(carddark3);
cards.Add(carddark4);
cards.Add(cardnature1);
cards.Add(cardnature2);
cards.Add(cardnature3);
cards.Add(cardnature4);
//get data from DB
for i := 0 to Length(ManaTypes) - 1 do
begin …Run Code Online (Sandbox Code Playgroud) 我有一些价值观
Quantity := 5;
Quantity2 := 8;
percent :=50;
Run Code Online (Sandbox Code Playgroud)
所以我想要
Percent of Quantity + Quantity 2
Run Code Online (Sandbox Code Playgroud)
这将是:13%的50%= 6.5
我是这样做的
HowMuchDamage := trunc(percent*(Quantity + Quantity2)/100);
Run Code Online (Sandbox Code Playgroud)
我该如何围捕?我怎样才能让它成圆形?
我需要调用事件处理程序来告诉用户选择TCard或TLabel
,然后返回该值作为参数。
我有两个单位GAME,SS_SPELL
这就是 SS_SPEll 中的代码的工作原理。
// TSPELL
// ======
// The chronology is:
// 1. At appropriate points in the game (such as before turn, after cast etc aka trigger points)
// the game calls the SpellMeister's RunSpells method.
// 2. RunSpells checks the database for spells matching the card that
// initiated the spell action, and the trigger point at which it did so.
// For each one that it finds it …Run Code Online (Sandbox Code Playgroud)