インコとチョコグラその3
| 固定リンク
| コメント (0)
| トラックバック (0)
一昨年導入したチョコグラが産卵しました。
去年も一度産卵して、オスが卵を咥えていたんだけど、グッピー用の産卵ケース(底が細くなってるタイプ)に隔離したせいか、親魚を疲弊させ、死なせてしまっていました。
その後、何回か卵を咥えているっぽい事があったけどそのままにしていたんですが、去年の12月に明らかに卵を咥えている個体がいたので、ためしに隔離していました。(今回は産卵ネットのみで底が平らなので親魚の負担も少なかった様子)
年明けくらいに稚魚を吐くといいなと思ってたところ12/29に稚魚を吐きだしていました:
最初は4匹だけだったのが、最終的には41匹も吐き出してました。かなり小さなオスだったので思いの他稚魚の数が多くてびっくり。
残念ながら稚魚を吐きだす瞬間を一度も目撃できず。
とりあえず20匹をチョコグラの親水槽に浮かべたネットに、残りの21匹を45cm Cubeに浮かべておきました。
ただ、年末で家を留守にする時期だったため稚魚へのエサは31日の朝にブラインを与えることができたものの、1/4までほぼ絶食状態でした。早めに帰宅したものの、冷凍ブラインは食べないし、粉餌ももちろん食べません。ブラインの孵化には24時間以上かかるので結構焦りました。
後で稚魚の数を数えたところ、チョコグラの親水槽の稚魚は20匹から12匹に減ってしまってました。申し訳ない。
45cm Cubeのほうは21匹全て生きていたものの、10日目までに、生まれた時からベリースライダー?のようだった個体を含め2匹を死なせてしまい、現状は19匹の計31匹になってます。
親水槽よりも45cm cubeのほうが生存率がよかった理由はわからず。ミジンコ類が結構湧いていたからかもしれません。
最初の絶食が悪かったのか、ネットで見かける繁殖例に比べて少し小さいかな。目測7mmくらい。
でもしっかりとチョコレートグラミーの体型になってきてます。眼をギョロっと動かして可愛い。
| 固定リンク
| コメント (2)
| トラックバック (0)
interface
{$IFDEF MSWINDOWS}
uses
System.Classes, Winapi.Windows, Winapi.Messages, FMX.Menus;
type
TAccelkeyTable = class
private
var FTable : array of TMenuItem;
protected
public
procedure Init;
procedure Add(menuitem : TMenuItem);
procedure Remove(menuitem : TMenuItem);
function Translate(var msg : TMsg) : Boolean;
function CheckShortCut(Handle : HWND; var Key: Word; var KeyChar: System.WideChar; Shift: TShiftState): Boolean;
end;
var
AccelKeyTable : TAccelKeyTable = nil;
{$ENDIF}
implementation
{$IFDEF MSWINDOWS}
{ TAccelkeyTable }
procedure TAccelkeyTable.Add(menuitem: TMenuItem);
var
i : integer;
begin
i := Length(FTable);
SetLength(FTable, i+1);
FTable[i] := menuitem;
end;
procedure TAccelkeyTable.Init;
begin
Initialize(FTable);
end;
procedure TAccelkeyTable.Remove(menuitem: TMenuItem);
var
i, cnt : integer;
begin
cnt := Length(FTable);
for i := 0 to cnt-1 do
begin
if FTable[i] = menuitem then
begin
FTable[i] := nil;
break;
end;
end;
end;
function TAccelkeyTable.Translate(var msg: TMsg): Boolean;
var
Shift : TShiftState;
Key : Word;
KeyChar : System.WideChar;
begin
result := false;
if msg.message = WM_KEYDOWN then
begin
Shift := [];
if (GetKeyState(VK_SHIFT) and $80) <> 0 then Shift := Shift + [ssShift]
else if (GetKeyState(VK_CONTROL) and $80) <> 0 then Shift := Shift + [ssCtrl]
else if (GetKeyState(VK_MENU) and $80) <> 0 then Shift := Shift + [ssAlt];
Key := LOWORD(msg.wparam);
KeyChar := System.WideChar(LOWORD(msg.lParam));
result := CheckShortCut(msg.hwnd, Key, KeyChar, Shift);
end;
end;
function TAccelkeyTable.CheckShortCut(Handle : HWND; var Key: Word; var KeyChar: System.WideChar; Shift: TShiftState) : Boolean;
var
i, cnt : integer;
sc : TShortCut;
begin
result := false;
sc := scNone;
if ssShift in Shift then sc := sc or scShift
else if ssCtrl in Shift then sc := sc or scCtrl
else if ssAlt in Shift then sc := sc or scAlt;
if Key > 32 then
begin
sc := sc or Key;
//Application.MainForm.Caption := ShortCutToText(sc); // debug
cnt := Length(FTable);
for i := 0 to cnt-1 do
begin
if (FTable[i] <> nil) and (FTable[i].ShortCut = sc) then
begin
SendMessage(Handle, WM_COMMAND, NativeUInt( FTable[i] ), 0);
result := true;
break;
end;
end;
end;
end;
initialization
{$ENDIF}
end.
このクラスのインスタンスを作り、ショートカットを設定したTMenuItemをすべて登録してください:
AccelKeyTable.Add( mnuSaveAs );
AccelKeyTable.Add( mnuCopy );
....
みたいな感じ
個人的にはTMainMenu/TMenuItemを派生したクラスを作って自動で登録するようにしてます。
interface
・・・
type
TForm1 = class(TForm)
・・・
protected
・・・
procedure KeyDown(var Key: Word; var KeyChar: System.WideChar; Shift: TShiftState); override;
・・・
・・・
end;
implementation
・・・
procedure TForm1.KeyDown(var Key: Word; var KeyChar: System.WideChar; Shift: TShiftState);
begin
{$ifdef MSWINDOWS}
if not AccelKeyTable.CheckShortCut(FmxHandleToHWND(Handle), Key, KeyChar, Shift) then
inherited;
{$else}
inherited;
{$endif}
end;
・・・
| 固定リンク
| コメント (2)
| トラックバック (0)
screen := (ctrl as IControl).localToScreen(local); や local := (ctrl as IControl).ScreenToLocal(screen); みたいな感じこういうVCLと同じ機能は名前もアクセス指定子もVCL準拠にして欲しかった。
unit FMXMouse;
interface
uses
System.Types, FMX.Platform
{$ifdef MSWINDOWS}
,Winapi.Windows
{$endif}
{$ifdef MACOS}
,Macapi.CoreGraphics, Macapi.CocoaTypes
{$endif}
;
type
TMouse = class
public
procedure SetCursorPos(const point : TPointF);
function GetCursorPos: TPointF;
property CursorPos : TPointF read GetCursorPos write SetCursorPos;
end;
var
Mouse : TMouse = nil;
implementation
{ TMouse }
{$ifdef MACOS}
procedure TMouse.SetCursorPos(const point: TPointF);
var
cgpoint : NSPoint;
begin
cgpoint.x := point.X;
cgpoint.y := point.Y;
CGWarpMouseCursorPosition(cgpoint);
end;
{$endif}
{$ifdef MSWINDOWS}
procedure TMouse.SetCursorPos(const point: TPointF);
begin
Winapi.Windows.SetCursorPos(round(point.X), round(point.Y));
end;
{$endif}
function TMouse.GetCursorPos: TPointF;
begin
result := Platform.GetMousePos;
end;
initialization
Mouse := TMouse.Create;
finalization
Mouse.Free;
end.
ユニット名、クラス名などはお好きにどうぞ。
| 固定リンク
| コメント (0)
| トラックバック (0)
if Shift*[ssLeft,ssMiddle,ssRight] = [] then
...
case Button of
TMouseButton.mbLeft : Shift := Shift - [ssLeft];
TMouseButton.mbRight : Shift := Shift - [ssRight];
TMouseButton.mbMiddle: Shift := Shift - [ssMiddle] ;
end;
if Shift * [ssLeft, ssMiddle, ssRight] = [] then
...
interface
TESXBitmap = class(TBitmap)
protected
procedure DefineProperties(Filer: TFiler); override;
procedure ReadBitmap(Stream: TStream);
procedure WriteBitmap(Stream: TStream);
end;
implementation
{ TESXBitmap }
procedure TESXBitmap.DefineProperties(Filer: TFiler);
begin
Filer.DefineBinaryProperty('PNG', ReadBitmap, WriteBitmap, Width * Height > 0);
end;
procedure TESXBitmap.ReadBitmap(Stream: TStream);
begin
LoadFromStream(Stream);
end;
procedure TESXBitmap.WriteBitmap(Stream: TStream);
var
Filter: TBitmapCodec;
this : TBitmap;
begin
filter := DefaultBitmapCodecClass.Create;
this := self;
filter.SaveToStream(Stream, this, 'png');
filter.Free;
end;
| 固定リンク
| コメント (0)
| トラックバック (0)
最近のコメント