Oct 6, 2011 01:27 PM
(This post was last modified: Oct 6, 2011 06:36 PM by codecaine.)
I will be writing some example of using Mac API and Windows API in firemonkey. I was wondering if anybody is interested more in one than the other OS. I think I should tackle Unix API more because windows API is the same as regular Delphi except the units are different. It is Winapi.Windows and Winapi.ShellAPI then can do the standard SendMessage BitBlt etc...
I finish laying out components. I am about to head to the gym. I should be done writing code sometime tonight. Here is what it looks like so far.
[img]http://img508.imageshack.us/img508/3708/exampleb.png[/img]
Some languages I know are Delphi, Pascal, Java, C, C++, BASH, AWK, GEL, Ruby, Python, Lazarus, HTML, PHP, SQL, and C#.
Oct 7, 2011 04:56 PM
(This post was last modified: Oct 7, 2011 04:59 PM by codecaine.)
Attached on my site is the source code and binary if anybody is interested. Firemonkey is still a buggy product as I work with it. http://www.freelancecode.net/community/v...p=379#p379
PHP Code
<?php unit Unit1;
interface
uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Objects, FMX.ListBox, FMX.Layouts, FMX.Memo, FMX.Edit, Posix.Stdlib, Posix.UniStd;
type TMainForm = class(TForm) SystemGroupBox: TGroupBox; SpeechEdit: TEdit; SpeakBn: TButton; POpenGroupBox: TGroupBox; PipeMemo: TMemo; CmdEdit: TEdit; ExecuteBn: TButton; CmdGroupBox: TGroupBox; bCmdList: TListBox; OpenGroupBox: TGroupBox; FileCmdGroupBox: TGroupBox; OpenFileGroupBox: TGroupBox; OpenEdit: TEdit; OpenBn: TButton; AuthorLabel: TLabel; siteLabel: TLabel; fCmdList: TListBox; procedure SpeakBnClick(Sender: TObject); procedure SpeechEditKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); procedure bCmdListChange(Sender: TObject); procedure fCmdListChange(Sender: TObject); procedure OpenBnClick(Sender: TObject); procedure ExecuteBnClick(Sender: TObject); private { Private declarations } public { Public declarations } end;
var MainForm: TMainForm;
implementation
{$R *.fmx}
procedure TMainForm.bCmdListChange(Sender: TObject); begin //if an item is selected on change the command edit to the selected text if bCmdList.ItemIndex <> -1 then cmdEdit.Text := bCmdList.Items.Strings[bCmdList.ItemIndex]; end;
procedure TMainForm.ExecuteBnClick(Sender: TObject); begin ShowMessage('This is not implemented yet. I am trying to find a header that has piping without bugs.'); end;
procedure TMainForm.fCmdListChange(Sender: TObject); begin //if an item is selected on change the open edit text is change to selected text if fCmdList.ItemIndex <> -1 then begin OpenEdit.Text := fCmdList.items.Strings[fCmdList.ItemIndex]; end; end;
procedure TMainForm.OpenBnClick(Sender: TObject); begin //open a program on the system if Trim(OpenEdit.Text) <> '' then Posix.Stdlib._system(PAnsiChar( 'open ' + AnsiString(OpenEdit.Text))); end;
procedure TMainForm.SpeakBnClick(Sender: TObject); begin //if speechedit is not empty continue if Trim(SpeechEdit.Text) <> '' then begin Posix.Stdlib._system(PAnsiChar( 'say ' + AnsiString(SpeechEdit.Text))); //execute system api call and say program on mac SpeechEdit.Text := ''; //clear text end; end;
procedure TMainForm.SpeechEditKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); begin //if key equals return if KeyChar = #0 then SpeakBnClick(nil); //execute click event on SpeakBn end;
end.
Some languages I know are Delphi, Pascal, Java, C, C++, BASH, AWK, GEL, Ruby, Python, Lazarus, HTML, PHP, SQL, and C#.
Nice share here, I am going to start programming in Delphi again as I have caught up with work.
|