It turns out that among other bugs, sometimes the TForm.StyleBook property does not automatically get assigned. If you make sure it is assigned, then the above steps work.
Quick steps:
- Create form.
- Drop style book on form, and assign Form.StyleBook = StyleBook1
- Right click on control you wish to modify style on, click Edit Custom Style.
- Go to object inspector and modify Fill property to change background color of panel, for instance.
- Apply and close. (May have to click two, three or four times due to window focus bugs)
Note: This workaround is not useful in Delphi XE4 and up as the feature "Custom style setting" was removed from Mobile application FMX.
For Windows you can use the GetUserName
WinAPi function, for OSX you can use the NSUserName
and/or NSFullUserName
methods.
Try this sample for OSX
{$APPTYPE CONSOLE}
{$R *.res}
uses
Macapi.CoreFoundation,
Macapi.Foundation,
System.SysUtils;
function NSUserName: Pointer; cdecl; external '/System/Library/Frameworks/Foundation.framework/Foundation' name _PU +'NSUserName';
function NSFullUserName: Pointer; cdecl; external '/System/Library/Frameworks/Foundation.framework/Foundation' name _PU + 'NSFullUserName';
begin
try
Writeln(Format('User Name %s',[TNSString.Wrap(NSUserName).UTF8String]));
Writeln(Format('Full User Name %s',[TNSString.Wrap(NSFullUserName).UTF8String]))
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
For Windows
{$APPTYPE CONSOLE}
uses
Windows,
SysUtils;
function WUserName: String;
var
nSize: DWord;
begin
nSize := 1024;
SetLength(Result, nSize);
if GetUserName(PChar(Result), nSize) then
SetLength(Result, nSize-1)
else
RaiseLastOSError;
end;
begin
try
Writeln(WUserName);
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
readln;
end.
Compiled into a single unit:
uses
{$IFDEF MACOS}
MacApi.CoreFoundation, MacApi.Foundation,
{$ENDIF}
{$IFDEF MSWINDOWS}
Windows,
{$ENDIF}
System.SysUtils;
{$IFDEF MACOS}
function NSUserName: Pointer; cdecl; external '/System/Library/Frameworks/Foundation.framework/Foundation' name '_NSUserName';
{$ENDIF}
function GetUserName: String;
{$IFDEF MSWINDOWS}
var
nSize: DWord;
{$ENDIF}
begin
{$IFDEF MACOS}
Result := TNSString.Wrap(NSUserName).UTF8String;
{$ENDIF}
{$IFDEF MSWINDOWS}
nSize := 1024;
SetLength(Result, nSize);
if Windows.GetUserName(PChar(Result), nSize) then
begin
SetLength(Result, nSize - 1)
end
else
begin
RaiseLastOSError;
end
{$ENDIF}
end;
Best Answer
FireMonkey comes from the former DXScene library, which has been acquired by Embarcadero.
You've plenty of information and screenshots in this blog site: http://ksdev.blogspot.com/
Eugene wrote in his forum that all registered users (like me) will get the Embarcadero version "for free"...
Here are the features of DXScene - working with FreePascal compiler to run under Linux or Mac OS X:
We can guess that FireMonkey will have some of these features, depending on the new Delphi XE2 cross-compiling features. Will it build OSX, iOS, Linux apps? Does it require XCode?
In short, FireMonkey will allow you:
But FireMonkey is not compatible with the GUI part of the VCL. It's a brand new library, with its own architecture, which is indeed based on the former DXScene.
All details available at http://www.deltics.co.nz/blog/?p=735
I think Mac OS X support is reduced to 32 bit version, because FireMonkey uses the Carbon API, which is 32 bit only. See http://developer.apple.com/carbon It’s worth saying that making a Mac OS X 64 bit version will need to use an "Objective C" syntax (or linking) and direct Cocoa. Some additional work…
I’m still waiting for the Linux version. FireMonkey ancestor (aka DXScene) was already Linux ready (using GTK/Pango/Cairo/OpenGL), and they already have an ELF linker in-house (the one from Kylix, which was very good). I understand that Mac OS X had a higher priority in the list, since it’s a more common platform for desktop computing. But for server applications, Linux is a most have. In XE3, may be?
Edit: previous "pessimistic" version - extracted ;)
Edit: I’ve made some screenshots of DXScene components demo - it may help you have a better impression on what FireMonkey will be.