Showing posts with label screen. Show all posts
Showing posts with label screen. Show all posts
Sunday, 27 July 2014
Delphi XE Android App Emulator Problem
I have recently been using Delphi XE5 do produce an Android mobile app. All was looking good until I wanted to run the app, the Android SDK comes with an Android emulator, but when I tried running the App from Delphi with the emulator running I just got a blank screen. When I plugged an Android device in it ran fine, so I thought it must be an issue with the emulator. After a few days of using the device I thought I would look into how to fix the emulator issue. All you need to do to fix this problem is to turn on the 'Use host GPU' option when setting up the device in the emulator, after that it will run, however there is another annoying issue, it is very slow.
Sunday, 20 January 2013
FireMonkey Transparent Theme
I saw in a post that FireMonkey has a theme for transparent LCD screens (http://www.youtube.com/watch?v=pVCeduZRMkc). The theme looks impressive and like something out of the film Tron, however I don't know how well it will work with transparent screens, the controls are the standard set which I don't think will work that well on touch screens. I think for touch screens there needs to be a set of new controls developed.
Thursday, 22 November 2012
Screen flicker with gradient background
Recently I had a problem with flickering when resizing a screen due to a gradient background. The problem was mainly noticeable with control on top of the background. Below are a couple of snippets that might help.
First I tried this:
// Interface
procedure WMEraseBackground(var _message:TMessage); message WM_ERASEBKGND;
// Implementation
procedure TForm.WMEraseBackground(var _message: TMessage);
begin
_message.Result := 1;
end;
This helped with the flicker on the gradient panel, but I noticed other issues with some other controls not painting correctly and a panel having a thicker border. Then I tried this:
// Interface
procedure WMEnterSizeMove(var Message:TWMMove); message WM_ENTERSIZEMOVE;
procedure WMExitSizeMove(var Message:TWMMove); message WM_EXITSIZEMOVE;
procedure TfrmMain.WMEnterSizeMove(var Message: TWMMove);
begin
// Set controls to visible = false
end;
procedure TfrmMain.WMExitSizeMove(var Message: TWMMove);
begin
// Set controls to visible = true
end;
Doing this really helped the other controls from flicking, when the user resizes the window the controls disappear and then reappear once the resize is complete.
First I tried this:
// Interface
procedure WMEraseBackground(var _message:TMessage); message WM_ERASEBKGND;
// Implementation
procedure TForm.WMEraseBackground(var _message: TMessage);
begin
_message.Result := 1;
end;
This helped with the flicker on the gradient panel, but I noticed other issues with some other controls not painting correctly and a panel having a thicker border. Then I tried this:
// Interface
procedure WMEnterSizeMove(var Message:TWMMove); message WM_ENTERSIZEMOVE;
procedure WMExitSizeMove(var Message:TWMMove); message WM_EXITSIZEMOVE;
procedure TfrmMain.WMEnterSizeMove(var Message: TWMMove);
begin
// Set controls to visible = false
end;
procedure TfrmMain.WMExitSizeMove(var Message: TWMMove);
begin
// Set controls to visible = true
end;
Doing this really helped the other controls from flicking, when the user resizes the window the controls disappear and then reappear once the resize is complete.
Labels:
background,
Delphi,
flicker,
flickering,
gradient,
move,
problem,
refresh,
resize,
screen,
solution,
wm_entersizemove,
wm_erasebkgnd,
wm_exitsizemove
Tuesday, 6 November 2012
Prevent screen refresh and flickering
To prevent screen refresh and flickering in an application it is often useful to lock the screen. This can occur with data aware controls which involve iteration and can make the application look strange to the user. I have found 2 solutions to this problem, the first is the one I use most of the time, but the second also works well.
Solution 1
LockWindowUpdate(Handle);
try
// Code goes here
finally
LockWindowUpdate(0);
end;
Solution 2
SendMessage(Handle, WM_SETREDRAW, WPARAM(False), 0);
try
// Code goes here
finally
SendMessage(Handle, WM_SETREDRAW, WPARAM(True), 0);
RedrawWindow(Self.Handle, nil, 0, RDW_ERASE or RDW_FRAME or RDW_INVALIDATE or RDW_ALLCHILDREN);
end;
These 2 solutions help with screen refresh, however there are other instances when these do not work, for example when using a gradient background.
Solution 1
LockWindowUpdate(Handle);
try
// Code goes here
finally
LockWindowUpdate(0);
end;
Solution 2
SendMessage(Handle, WM_SETREDRAW, WPARAM(False), 0);
try
// Code goes here
finally
SendMessage(Handle, WM_SETREDRAW, WPARAM(True), 0);
RedrawWindow(Self.Handle, nil, 0, RDW_ERASE or RDW_FRAME or RDW_INVALIDATE or RDW_ALLCHILDREN);
end;
These 2 solutions help with screen refresh, however there are other instances when these do not work, for example when using a gradient background.
Labels:
Delphi,
flickering,
locking,
LockWindowUpdate,
RedrawWindow,
screen
Subscribe to:
Posts (Atom)