I am install Indy from Online package manager, but cannot use indy component like IdTCPClient in my project, it will alert error:
Fatal: Can't find unit IdTCPClient used by Unit1
my source code:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, IdTCPClient;
type
TForm1 = class(TForm)
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
end.
and the package screenshot (means installed Indy proper):
In your project, go to Project->Project Inspector, then right click "requires Packages" and add indylaz
Related
Is it possible to get Android.View (and equivalent view object in iOS) from Xamarin.Form.View? I have custom control which takes dependencies to Android.View. I am writing custom renderer which would set that custom control as native view but I need to convert my ContentView (exposed as BindableProperty, initialized in xaml) from Portable library to Android.View.
Yes you can. I have written an extension that uses reflection to get the underlying native view:
https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/src/Forms/XLabs.Forms.Droid/Extensions/ViewExtensions.cs#L54-L59
Native view in the code is Android.Views.View type and View is Xamarin.Forms.View.
https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/src/Forms/XLabs.Forms.Droid/Extensions/ViewExtensions.cs#L19
The same works for iOS as well, just cast it to UIView.
I would like to create an application with multiple views in XCode 4 for Mac, one of them which should display OpenGL.
Using Interface Builder, can I use the standard OpenGL view and still use Glut to program and display in this view ?
Thanks !
No, GLUT is a minimalistic framework, not to be used in serious applications or be mixed with other frameworks. As long as your GLUT applications just uses the canonical display, reshape, keyboard, mouse callback handlers, just call these from your GLView Cocoa code in your implementation of the interface.
The Windows 7 UX guide has nice illustrations and examples of icons, but I really can't find them in the SDK. Are they hiding somewhere, or are they not available ?
If you are talking about the common UI icons, then you are supposed to get them programmatically. For instance, you can use
var
errIcon: HICON;
begin
errIcon := LoadIcon(0, IDI_ERROR);
DrawIcon(Canvas.Handle, 10, 10, errIcon),
(Delphi code) to draw an error icon.
See LoadIcon, DrawIcon at MSDN. You might also wish to study STATIC controls.
To draw other visual elements, you need to use the visual themes API, e.g. the DrawThemeBackground function that accepts a class, part, and state and then draws it:
SHGetStockIconInfo has a decent list of system icons.
I am improving a small alarm/reminder application that I build years ago, and I would like to do an hourly beep, but instead of beeping it would be much nicer it would tell time.
Is there any simple way to do this in DELPHI D2007 or later?
Check Brian Long tutorial's
Speech Synthesis & Speech Recognition Using SAPI 5.1
I wrote a text to speech software using this tutorial.
It reads the clipboard content when I press CTRL + F10
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComObj;
[...]
procedure TForm1.Button1Click(Sender: TObject);
var
Voice: Variant;
begin
Voice := CreateOLEObject('SAPI.SpVoice');
Voice.speak('Hello World');
end;
I did a video awhile back on making your applications talk in Delphi. I personally haven't ever found a use for text to speech in one of my applications, but it's a fun thing to know how to do ;-)
In my code I use MS Agent and TAgntSrvr component:
http://delphi.icm.edu.pl/ftp/d30free/agntsrvr.htm
Also you can check this link or just Google around: "text speech delphi"
You can use eSpeak with Delphi to support more languages and Mac (and hopefully Linux in the future). Delphi example is here.
There is some Win OS API call or so that would let one obtain text from the screen
not via obtaining a snapshot and then doing OCR on it, but via API
the idea is to get the text that is under the mouse that the user points to and clicks on.
This is how tools like Babylon (http://www.babylon.com) and 1-Click Answers (http://www.answers.com/main/download_answers_win.jsp) and many others work.
Can someone point me to the right direction to get this functionality?
There is no direct way to obtain text. An application could render text in a zillion different ways (Windows API being one of them), and after it's rendered - it's just a bunch of pixels.
A method you could try however is to find the window directly under the mouse and trying to get the text from them. This would work fine on most standard Windows controls (labels, textboxes, etc.) Wouldn't work on Internet browsers though.
I think the best you can do is make your application such that it supports as many different (common) controls as possible in the above described manner.
You can get the text of every window with the GetWindowText API. The mouse position can be found with the GetCursorPos API.
In Delphi you could use this function (kudos to Peter Below)
Function ChildWindowUnderCursor: HWND;
Var
hw, lasthw: HWND;
pt, clientpt: TPoint;
Begin
Result := 0;
GetCursorPos( pt );
// find top-level window under cursor
hw := WindowFromPoint( pt );
If hw = 0 Then Exit;
// look for child windows in the window recursively
// until we find no new windows
Repeat
lasthw := hw;
clientpt := Pt;
Windows.ScreenToClient( lasthw, clientpt );
// Use ChildwindowfromPoint if app needs to run on NT 3.51!
hw := ChildwindowFromPointEx( lasthw, clientpt, CWP_SKIPINVISIBLE );
Until hw = lasthw;
Result := hw;
End;
Regards,
Lieven
Windows has APIs for accessibility tools like screen-readers for the blind. (Newer versions are also used for other purposes, like UI automation and testing.) It works with many applications, even most browsers which render their own content without using the standard Windows controls. It won't work with all applications, but it can be used to figure out the text under the mouse in most cases.
The current API is called the Windows Automation API. Describing how to do this in general is beyond the scope of a Stack Overflow answer, so I've simply provided a link to the documentation.
The older API that was widely available when this question was first posted is called the Microsoft Active Accessibility API. As with the modern APIs, the scope here is too broad to detail here.
Note that documentation for both APIs is written both for both developers building accessibility tools (like screen readers) as well as for developers writing apps that want to be compatible with those accessibility tools.
The basic idea is that an accessibility tool gets COM interfaces provided by the target application's window(s), and it can use those interfaces to figure out the controls and their text and how they're related both logically and spatially. Applications that are composed of standard Windows controls are mostly automatically supported. Applications with custom UI implementations have to do work to provide these interfaces. Fortunately, the important ones, like the mainstream browsers, have done the work to support these interfaces.
i think its called the clipboard. i am going to bet these programs inject click and double click & keyboard events and then copy items there for inspection. Alternatively, they are gettin jiggy with the windows text controls, and grabbing content that way. i suspect due to security issues, these tools have problems running in vista also.