Profile cover photo
Profile photo
Gustav Schubert
'works' on corner case projects
'works' on corner case projects
About
Posts

Post has attachment
Front page sample.
Photo

Blog post about resizing a TViewport3D.
http://federgraph.blogspot.de/2017/08/resizing-t-viewport-3d.html
I am learning how to blog. Blog is intended to help the users of my app. Not much content there so far. Need to start blogging about using the app soon. But had to clear my mind first.

The "Federgraph" Desktop Bridge app is "in the Store" now (Windows).

"With the OSX target you have to use KeyDown instead of KeyUp handlers."
Is this a safe, known assumption and according to the guidelines?

Test app (Berlin) with one line in FormKeyUp event handler:

Caption := KeyChar;

Press key, then shift-key twice. (m M M)

Caption on Windows: 'm', 'M', 'M'
Caption on Mac: 'm', 'm', 'M'



My application uses key strokes to cycle through state.
Technically I will inc/dec an Integer property.
Initial value is 1.

normal key: inc (cycle forward)
shift key: dec (cycle backward)

If I want to change state like this:
2-3-4-3-2 //expected
m-m-m-M-M //keys pressed

I get
2-3-4-3-2 //on Windows
2-3-4-5-4 //on Mac

Found nothing in QP.
Any other problems related to this?
Known fix?
(I am using KeyDown and will be ok for now.)

(Another problem with KeyUp is the annoying sound produced by the arrow, home/end and prior/next keys.)

Happened yesterday:

Workaround found for the FMX TMainMenu Visibility problem!

On the touch screen you don't want the menu, except for the case when you 'temporarily need it'.

So, you build the menu at runtime, then destroy and recreate via touch button.

Recreation will result in a firework, flicker and flacker for about 4 seconds, because RecreateOSMenu is called for each TMenuItem you add.

Implementation section only workaround:

procedure TMainMenu.RecreateOSMenu;
var
Form: TOpenCustomForm;
begin
if (Tag > -1) //trick
and ([csDestroying] * ComponentState = []) then
begin
...
end;
end;

//from the test app...
procedure TFormMain.SetMainMenuVisible(const Value: Boolean);
begin
if Value and not Assigned(MainMenu) then
begin
MainMenu := TMainMenu.Create(self);
MainMenu.Tag := -1
MainMenu.Parent := self;
PopulateMenu; //custom code
UpdateMenu; //custom code
MainMenu.Tag := 1;
MainMenu.RecreateOSMenu; //once
end
else if Assigned(MainMenu) and not Value then
begin
MainMenu.Free;
MainMenu := nil;
end;
end;

Have you seen menu flicker in other situations?
Do you want a visible property?
Do you want to build a minimal test case and report it?

(My test case is too long; I use my real populate menu code.)

Did you manage to include a Logo50x50 in your appx for the store?

I was told by 'my' Mircosoft AppConsult Engineer that it is required.

I don't know if it is really required. Nor have I tried to upload without. (This will be next.)

'Hello' from FMX TStringGrid, with style (TStyledGrid):

procedure TForm3.StringGrid1EditingDone(
Sender: TObject; const ACol, ARow: Integer);
begin
StringGrid1.Model.EditorMode := False;

if StringGrid1.Model.EditorMode then
Caption := 'Hello!'
else
Caption := 'Foo';
end;

(see details in a comment.)

uses System.Generics.Collections;
TFoo = array of Integer;
TBar = class(TList<TFoo>);

Note that I have defined more than 1000 Integer constants (ActionIDs) and want to partition the whole set into groups or categories, in different fashions. I experimented a little and came up with something that compiles. It is convenient to edit the groups in the code editor where the design work happens. But it does not work at runtime. I cannot retrieve the Integer values as expected from the List. Why? Debugging is difficult. So please explain.

Code:

program IntGroupTest;

{$APPTYPE CONSOLE}

{$R *.res}

uses
System.SysUtils,
System.Classes,
System.Generics.Collections;

type
TActionGroup = array of Integer;

TActionGroupList = class(TList<TActionGroup>)
public
constructor Create;
end;

const
Action1 = 1;
Action2 = 2;
Action3 = 3;
Action4 = 4;
Action5 = 5;
Action6 = 6;

ActionGroup1: TActionGroup = [
Action1,
Action2,
Action3
];

ActionGroup2: TActionGroup = [
Action4
];

ActionGroup3: TActionGroup = [
Action5,
Action6
];

constructor TActionGroupList.Create;
begin
inherited;
Add(ActionGroup1);
Add(ActionGroup2);
Add(ActionGroup3);
end;

var
AG: TActionGroup;
AGL: TActionGroupList;

begin
try
AGL := TActionGroupList.Create;

//this does not work.
AG := AGL.Items[0];
WriteLn(Format('1 = %d', [AG[0]]));
WriteLn(Format('2 = %d', [AG[1]]));
WriteLn(Format('3 = %d', [AG[2]]));

//this is ok.
WriteLn('');
WriteLn(Format('1 = %d', [ActionGroup1[0]]));
WriteLn(Format('2 = %d', [ActionGroup1[1]]));
WriteLn(Format('3 = %d', [ActionGroup1[2]]));

ReadLn;

except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.

Output:

1 = 1
2 = 39069312
3 = 1

1 = 1
2 = 2
3 = 3

Berlin, Update 2, appx: Want to install locally, get Error 0x800B0109. Searched for appx in the help, but nothing. My question is: Did you succeed?
Wait while more posts are being loaded