delphi-xe7

TWebBrowser - Detecting the tag under caret

本秂侑毒 提交于 2019-12-24 10:25:39
问题 I want to detect on which HTML tag (more exactly hyperlink) is the caret. procedure THTMLEdit.ShowTag; var CursorPos: TPoint; HtmlElement: IHTMLElement; iHTMLDoc: IHtmlDocument2; begin if Supports(wbBrowser.Document, IHtmlDocument2, iHTMLDoc) then begin if GetcaretPos(CursorPos) then begin CursorPos := wbBrowser.screentoclient(CursorPos); HtmlElement := iHTMLDoc.ElementFromPoint(CursorPos.X, CursorPos.Y); // I NEED KEYBOARD CARET HERE, NOT MOUSE CURSOR if HtmlElement <> NIL then label1

how to login to website using HTTP Client in Delphi xe

六月ゝ 毕业季﹏ 提交于 2019-12-24 06:36:02
问题 i am trying to implement the HTTP Client in my project, i cant login to my account,i get Forbidden!, with IdHTTP its working well, whats is missing or wrong in my code ? NetHTTPClient1 properties: Connectiontimeout = 30000 AllowCookies = True HandleRedirects = True UserAgent = Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36 NetHTTPRequest1 Properties : Method String = POST URL = https://www.instagram.com

Adding true hyperlink support to TRichEdit

痴心易碎 提交于 2019-12-24 06:26:11
问题 I need support for "friendly name hyperlink" in TRichEdit and all solutions I have found are based on autoURLs (EM_AUTOURLDETECT) which works by detecting strings entered by user that start with www (or http). But I want to place links on strings that does not start with www. Example: 'Download'. 回答1: You need to do the following: send the RichEdit an EM_SETEVENTMASK message to enable the ENM_LINK flag. Do this once after the RichEdit has been created, and then do it again every time the

Invalid default library path in Delphi XE7

我的梦境 提交于 2019-12-23 20:17:50
问题 I had Delphi XE7 installed for a couple of days. I realized that some paths (library path, debug path) were invalid (shown in gray color). Even though I changed NOTHING in Delphi settings I supposed it was my fault. So, I uninstalled Delphi XE and Delphi XE7 altogether and all related addons. Then I reinstalled Delphi XE7. RIGHT AFTER install I opened the IDE and checked the paths. They are still invalid. See attached image. I also noticed that the $(Platform) variable is empty. I am on Win32

How to draw a dotted line in Firemonkey?

感情迁移 提交于 2019-12-23 17:25:09
问题 I want to draw a dotted grid on a TPaintbox canvas in a Firemonkey project, the outcome should be exactly like this: To start with I thought I would draw the vertical dotted lines and then the horizontal dotted lines, so with that in mind I attempted to draw a single line first in attempt to get the appearance just right, this is what I tried: Canvas.Stroke.Color := TAlphaColorRec.Black; Canvas.Stroke.Dash := TStrokeDash.Dot; Canvas.Stroke.Kind := TBrushKind.Solid; Canvas.Stroke.Thickness :=

How to get model number of the phone?

一曲冷凌霜 提交于 2019-12-23 16:07:03
问题 I am targeting Android with Delphi XE7. I would like to obtain the model number of the phone. That is, I would like to obtain the information highlighted in this image: How can I achieve this? 回答1: You can use DeviceType := JStringToString(TJBuild.JavaClass.MODEL); OSName := GetCodename(JStringToString(TJBuild_VERSION.JavaClass.RELEASE)); OSVersion := JStringToString(TJBuild_VERSION.JavaClass.RELEASE); There is a sample here. I hope it'll be useful 来源: https://stackoverflow.com/questions

How to handle very long file names (with TPath)?

◇◆丶佛笑我妖孽 提交于 2019-12-23 15:02:35
问题 I have a program that downloads some files from Internet. The file name could be very long (100 chars). The user may choose to save these these files in a folder that has a very long name (200 chars). So, the total length of the path is over 260 chars. I tried to create a function that checks if the path is too long and truncates the filename so the whole path will be exactly 260 chars. But functions in TPath class fails to work if the path is over 260 chars. More exactly GetDirectoryName

Insert colored line at the top of TRichEdit

旧城冷巷雨未停 提交于 2019-12-23 09:09:12
问题 I'm using a TRichEdit in order to show the last operations that have been done in my application. The first line of my TRichEdit should be the last operation. If the operation failed, I would like to put this line in red. My problem is that I am not able to insert a colored line at the top of my TRichEdit . Here is what I've tried: RichEditLog.SelAttributes.Color := clBlack; RichEditLog.Lines.Insert(0, 'Operation 1 OK'); // RichEditLog.Lines.Add('Operation 1 OK'); RichEditLog.SelAttributes

how do i get index of listview item where its subitem equal some string without using selected items?

安稳与你 提交于 2019-12-23 06:07:58
问题 i currently use list view inside my project i wanted to get index of some item by finding its subitem string , i have listview with item and subitem , item caption := name and subitem := id i want to find the index of this item where sub item := id , how could i do that , i searched while for some equations and didn't got one yet . reason that i need this because the subitem id have unique id and this much secure instead of using find item by caption 回答1: You need to loop through the list

Using C++ Classes in Delphi

人走茶凉 提交于 2019-12-22 17:43:21
问题 How can I use a C++ class in Delphi? I am trying to use it through an abstract class. However it doesn't work as expected I get weird numbers from Age(); . Delphi: program Test; {$APPTYPE CONSOLE} type IPerson = class function Age(): Integer; overload; virtual; stdcall; abstract; procedure Age(const Value: Integer); overload; virtual; stdcall; abstract; end; const DLL = 'Interface.DLL'; procedure FreePerson(const Person: IPerson); external DLL; function CreatePerson(): IPerson; external DLL;