Search Results

Search found 7 results on 1 pages for 'firemonkey'.

Page 1/1 | 1 

  • How to show a firemonkey form on second monitor

    - by Shaun07776
    I am trying to display a FireMonkey form on a second monitor, using C++Builder with following code: void __fastcall ShowFormOnScreen( int OutMon ) { MyForm->Top = 0; MyForm->BorderStyle = bsNone; MyForm->WindowState = wsNormal; MyForm->Left = Screen->Monitors[OutMon]->Left; MyForm->Height = Screen->Monitors[OutMon]->Height; MyForm->Width = Screen->Monitors[OutMon]->Width; MyForm->Show(); } Unfortunately, the Screen object does not have the Monitors property, so how can do this in FireMonkey?

    Read the article

  • Loading FireMonkey style resourses with RTTI

    - by HeMet
    I am trying to write class that inherits from FMX TStyledControl. When style is updated it loads style resource objects to cache. I created project group for package with custom controls and test FMX HD project as it describes in Delphi help. After installing package and placing TsgSlideHost on the test form I run test app. It’s work well, but when I close it and try to rebuild package RAD Studio says “Error in rtl160.bpl” or “invalid pointer operation”. It seems what problem in LoadToCacheIfNeeded procedure from TsgStyledControl, but I’m not understand why. Is there any restriction on using RTTI with FMX styles or anything? TsgStyledControl sources: unit SlideGUI.TsgStyledControl; interface uses System.SysUtils, System.Classes, System.Types, FMX.Types, FMX.Layouts, FMX.Objects, FMX.Effects, System.UITypes, FMX.Ani, System.Rtti, System.TypInfo; type TCachedAttribute = class(TCustomAttribute) private fStyleName: string; public constructor Create(const aStyleName: string); property StyleName: string read fStyleName; end; TsgStyledControl = class(TStyledControl) private procedure CacheStyleObjects; procedure LoadToCacheIfNeeded(aField: TRttiField); protected function FindStyleResourceAs<T: class>(const AStyleLookup: string): T; function GetStyleName: string; virtual; abstract; function GetStyleObject: TControl; override; public procedure ApplyStyle; override; published { Published declarations } end; implementation { TsgStyledControl } procedure TsgStyledControl.ApplyStyle; begin inherited; CacheStyleObjects; end; procedure TsgStyledControl.CacheStyleObjects; var ctx: TRttiContext; typ: TRttiType; fld: TRttiField; begin ctx := TRttiContext.Create; try typ := ctx.GetType(Self.ClassType); for fld in typ.GetFields do LoadFromCacheIfNeeded(fld); finally ctx.Free end; end; function TsgStyledControl.FindStyleResourceAs<T>(const AStyleLookup: string): T; var fmxObj: TFmxObject; begin fmxObj := FindStyleResource(AStyleLookup); if Assigned(fmxObj) and (fmxObj is T) then Result := fmxObj as T else Result := nil; end; function TsgStyledControl.GetStyleObject: TControl; var S: TResourceStream; begin if (FStyleLookup = '') then begin if FindRCData(HInstance, GetStyleName) then begin S := TResourceStream.Create(HInstance, GetStyleName, RT_RCDATA); try Result := TControl(CreateObjectFromStream(nil, S)); Exit; finally S.Free; end; end; end; Result := inherited GetStyleObject; end; procedure TsgStyledControl.LoadToCacheIfNeeded(aField: TRttiField); var attr: TCustomAttribute; styleName: string; styleObj: TFmxObject; val: TValue; begin for attr in aField.GetAttributes do begin if attr is TCachedAttribute then begin styleName := TCachedAttribute(attr).StyleName; if styleName <> '' then begin styleObj := FindStyleResource(styleName); val := TValue.From<TFmxObject>(styleObj); aField.SetValue(Self, val); end; end; end; end; { TCachedAttribute } constructor TCachedAttribute.Create(const aStyleName: string); begin fStyleName := aStyleName; end; end. Using of TsgStyledControl: type TsgSlideHost = class(TsgStyledControl) private [TCached('SlideHost')] fSlideHost: TLayout; [TCached('SideMenu')] fSideMenuLyt: TLayout; [TCached('SlideContainer')] fSlideContainer: TLayout; fSideMenu: IsgSideMenu; procedure ReapplyProps; procedure SetSideMenu(const Value: IsgSideMenu); protected function GetStyleName: string; override; function GetStyleObject: TControl; override; procedure UpdateSideMenuLyt; public constructor Create(AOwner: TComponent); override; procedure ApplyStyle; override; published property SideMenu: IsgSideMenu read fSideMenu write SetSideMenu; end;

    Read the article

  • Capturing USB Plug/Unplug events in Firemonkey

    - by radsdau
    [RAD Studio XE3 / C++] I have a FMX project running in Windows only at this stage, but I need to detect events when USB devices are connected and disconnected. I have a similar VCL app that can do this fine, but the Application-HookMainWindow is not exposed in FMX (only VCL). Is there an elegant way to handle this? Or do I have to hack some VCL stuff into my FMX app to make that work? I'd imagine I have to abstract it so I can support other platforms down the track. For the meantime though I need to get the Windows solution working. If the 'VCL hack' thing is required, how would I reference the vcl::Forms::Application from within my Fmx app? Cheers.

    Read the article

  • FireMonkey/Rad Studio XE2: How can I show the SaveDialog filter on OS X? [migrated]

    - by Zoltan Karpati
    I created an (Delphi XE2) Firemonkey sample program which contains a TButton and a TSavedialog with two different filters. (The TSaveDialog component supports the Win32/Win64 and OS X platform.) It works fine on Win32/Win64, but I don't now why it does not show the Savedialog filters on OS X (VirtualBox/OS X 10.7.x). How can I get it to work on OS X ? procedure TForm1.Button_SaveClick(Sender: TObject); begin SaveDialog.Filter:='Format_1 (*.fmt1)|*.fmt1|Format_2 (*.fmt2)|*.fmt2'; If Savedialog.Execute Then ShowMessage(SaveDialog.FileName+#13+'Selected filterindex: '+Inttostr(SaveDialog.FilterIndex)); end;

    Read the article

  • How to test using conditional defines if the application is Firemonkey one?

    - by Gad D Lord
    I use DUnit. It has an VCL GUITestRunner and a console TextTestRunner. In an unit used by both Firemonkey and VCL Forms applications I would like to achieve the following: If Firemonkey app, if target is OS X, and executing on OS X - TextTestRunner If Firemonkey app, if target is 32-bit Windows, executing on Windows - AllocConsole + TextTestRunner If VCL app - GUITestRunner {$IFDEF MACOS} TextTestRunner.RunRegisteredTests; // Case 1 {$ELSE} {$IFDEF MSWINDOWS} AllocConsole; {$ENDIF} {$IFDEF FIREMONKEY_APP} // Case 2 <--------------- HERE TextTestRunner.RunRegisteredTests; {$ELSE} // Case 3 GUITestRunner.RunRegisteredTests; {$IFEND} {$ENDIF} Which is the best way to make Case 2 work?

    Read the article

  • bottom uicomponent does not receive mouse events

    - by firemonkey
    HI, I am sure this is very basic, however I am not able to find the solution. I have a base ShapeContainer(UIComponent). I add a uicomponent which has mouse down listener to ShapeContainer. the listener works great. When I add a simple sprite(draw square) on the ShapeContainer, The listener does not work any more. In the code, if I comment below lines, The event listener works fine. var square:Sprite = new Sprite(); square.graphics.lineStyle(4,0x00FF00); square.graphics.drawRect(0,0,20,20); square.mouseEnabled=false; shapeContainer.addChildAt(square,1); I have tried few things like, mouseenabled=false on top sprite. also tried to add addChildAt but non of them did any help. How can I draw a shape and also have the event listener work. enter code here protected function application1_creationCompleteHandler(event:FlexEvent):void { var shapeContainer:UIComponent = new UIComponent(); shapeContainer.x=100; shapeContainer.y=100; shapeContainer.width=200; shapeContainer.height=200; rawChildren.addChild(shapeContainer); var EventListenerShape:UIComponent = new UIComponent(); EventListenerShape.x=100; EventListenerShape.y=100; EventListenerShape.width=200;a EventListenerShape.height=200; EventListenerShape.graphics.clear(); EventListenerShape.graphics.beginFill(0xf1f1f1, 0.1); EventListenerShape.graphics.drawRoundRect(0, 0, 200, 200, 10, 10); EventListenerShape.alpha = 0; EventListenerShape.graphics.endFill(); EventListenerShape.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownfunc); shapeContainer.addChild(EventListenerShape); var square:Sprite = new Sprite(); square.graphics.lineStyle(4,0x00FF00); square.graphics.drawRect(0,0,20,20); square.mouseEnabled=false; shapeContainer.addChildAt(square,1); } private function mouseDownfunc(e:MouseEvent){ trace("mouse Down **"); }    ]]> </mx:Script> <mx:Canvas id="uic" width="100%" height="100%" backgroundColor="0xFFFFFF"> </mx:Canvas>

    Read the article

  • I am trying to add a link on an Image

    - by firemonkey
    Hi, I am trying to add a link to an image using ActionScript. I do not see the link no matter what. Below is my code, Can you please suggest what am I doing wrong. <?xml version="1.0" encoding="utf-8"?> <mx:Application creationComplete="application1_creationCompleteHandler(event)" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"> <mx:Script> <![CDATA[ import mx.controls.Button; import mx.controls.Image; import mx.events.FlexEvent; protected function application1_creationCompleteHandler(event:FlexEvent):void { var but:Button = new Button(); but.label = "BUT"; uic.addChild(but); var dollLoader:Loader=new Loader(); dollLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dollCompleteHandler); var dollRequest:URLRequest = new URLRequest("http://www.google.com/intl/en_ALL/images/logo.gif"); dollLoader.load(dollRequest); uic.addChild(dollLoader); } private function dollCompleteHandler(event:Event):void { } ]]> </mx:Script> <mx:UIComponent id="uic" width="100%" height="100%"> </mx:UIComponent> </mx:Application>

    Read the article

1