Can I get popups on mouseover for inline documentation in Sublime Text? - lua

I'm used to Android Studio, which has these awesome popups when you hover your cursor over a function (or anything else), which shows you a description, parameters, etc.. Now I'm using Sublime Text 3 for Lua programming, and I would like to have a similar thing. I would prefer something that allows for inline documentation.
I found something called ToolTip-Helper and tried it out, but I couldn't get it to work unfortunately. I created the inline documentation as they describe, and placed my mouse over a function call further down, but no popup showed unfortunately. It does however resemble exactly what I'm looking for. Inline documentation and a simple popup on mouseover on a formula.
Does anyone know a tool that does these things, or perhaps know how to get ToolTip-Helper working?

Related

How can I make the 'Showmessage' dialog wider so it fits the text?

I'm showing where a file has been saved by using 'Showmessage' (in Win 7).
When the file path is long it gets truncated and elipsis get inserted.
eg
the path
C:\Users\Admin\Documents\SubFolderOne\AnotherSubFolder\MyFile.csv
gets displayed as
C:\Users\Admin\Documents\SubFolderOne\Ano...\MyFile.csv
Is there a way to make the message box wider and show all of the filename and path?
I have read this
http://zarko-gajic.iz.hr/displaying-long-non-breakable-text-file-path-in-messagedlg-truncationellipsis-issues/
which explains some of the reasoning and gives a rather unsatisfactory method for a TTaskDialog and I also I realise I could make my own form to act in the same way as Showmessage but I am wondering if there is a simpler solution using just Showmessage.
Is a simpler solution using just ShowMessage?
No there is not.
I can think of three obvious approaches, although doubtless there are more.
Create your own dialog
There's nothing particularly magical about a dialog. You can perfectly well create them yourself, and so have complete control over their appearance. The downside of course is that it can be hard to match the native platform appearance. Especially when you consider all the different Windows versions that you are typically expected to support.
Use CreateMessageDialog and customise this Delphi form
You can call the RTL function CreateMessageDialog to obtain a Delphi form that can be used to display your message dialog. You then have the opportunity to customize this dialog in any way you please.
Use the task dialog API
The task dialog API, introduced in Vista, affords control of the dialog width. Call TaskDialogIndirect, and specify a non-zero value for cxWidth.
Before ShowMessage put:
UseLatestCommonDialogs:= false;
I use Delphi 10.2 and it works.

Look of TComboBox changes after removing Drag&Drop component from Borland c++ Builder 2009 project

I noticed something strange, related to the Drag&Drop component from Anders Melander, and I wonder if anybody has an idea ?
I have been looking for the reason, without much success. However the effect is 100% repeatable by simply removing: DropFileTarget->Register(ComboBox); from the project's constructor.
The other day I noticed that the drop down box on my application was not looking right:
Whereas it previously looked (correct) like this:
So I started going back to figure out at what time the look of the component broke and I have now been able to trace the change in look 100% to:
DropFileTarget->Register(ComboBox);
If this line is present, the look is good.
If I remove this line of code from the form's constructor the look of the drop box is wrong !?
I actually wanted to remove DropFileTarget completely from my project since I now use another method to catch a dragged file.
Can anybody please tell me what Register() does here to change the look of the component, so that I can set the look back to what it should be.
My gut says it has to do with theme support as well somehow ?
ADDITIONAL INFORMATION BASED ON THE COMMENTS:
I did some tests. A normal looking Combobox, with theme support, looks like this:
With theme support disabled it looks like this:
In other words, the Drag&Drop component's Register() creates a special look, that I had grown used to, and of which I thought was the correct look.
The canvas where the text is displayed is white instead of grey (default settings).
I'm now torn between going for 'how it should be' or trying to create the look I had gotten used to.
Anybody knows what properties I should change to get the component-influenced look (second screenshot from the top) ?

Can I find out current typing co-ordinates in a notepad relative to desktop window

Is it possible for me to find out the typing co-ordinates (relative to desktop co-ordinates) in a notepad window from a Delphi application? For example, if we look at the below picture, I am typing on a notepad window. Can I find out the screen co-ordinates, where I am typing on notepad.
Edit
It would be helpful if someone can suggest a generic solution. Answer no1 speaks about notepad. How about a console window? Is it possible to figure out the co-ordinates, if i am typing on a console window?
I guess, if UAC would not disable it, you can implement the following sequence:
you have to learn the windows structure of the notepad. Using tools like WinSpy++, WinSight or ProcFS for Total Commander or whatever. And then you have to get the handle (HWND) of the actual editbox window. The topic of enumerating or finding other applications windows was discussed many times already on StackOverflow and on Google.
Then you have to ask the main edit window for it coordinates. See Get{Client/Window}Rect functions, see http://msdn.microsoft.com/en-us/library/windows/desktop/ms633503.aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519.aspx Perhaps even better would be to SendMessage the EM_GETRECT custom message: http://msdn.microsoft.com/en-us/library/ms997530.aspx
Then you have to know the position of caret: like TMemo.SelEnd and TEdit.SelStart - again best way would be to just read how they are implemented in VCL. Probably that would be rooted in SendMessage(EM_GETSEL,...) - http://msdn.microsoft.com/en-us/library/ms997530.aspx - there is a ready example to do this
Then you would have to ask Widows for relative coordinates of that position - relative to the Client Rect you get in above steps. See EM_POSFROMCHAR message http://msdn.microsoft.com/en-us/library/windows/desktop/bb761631.aspx and Delphi sample at http://www.delphipages.com/forum/showthread.php?t=33707
However some claims that this does not always work reliably: http://vbcity.com/forums/t/14951.aspx so as last resort you can use hard-core string parsing, as described in version 1 of this answer.

Automatic Typing Textarea/input/form in JavaScript

I've been searching for a way to make a textarea type inside of itself. Unfortunately, even with some google searching, I still don't have a clue? Do you guys know where to start with this?
http://lmgtfy |dot| com is an example, but I'm not sure if they use some other technique...
The lmgtfy people are simply using javascript to change the value of the input. Here is a simple jsfiddle showing the same thing:
http://jsfiddle.net/Caut6/1/
LMGTFY uses javascript. If you visit the site using chrome or some other browser with a debugger, you should be able to pause javascript execution and check out how they do it, then roll or copy your own version.
In Chrome, the pause button is under the Scripts area. Their bundle.js files appears to host the JS you are looking for, it is around 1000 lines of code, but you should be able to see the few functions you need to borrow their implementation.
Hope this helps.

How do I make a TLinkLabel work in Delphi?

I put a TLinkLabel on my form, filled it in with a caption including a valid HTML link, and got some nice blue underlined text. When I ran the program, I expected it to invoke Firefox (my default browser) and open the link automatically. Apparently that's not the case.
The helpfile says I have to code this in an OnLinkClick event handler. It doesn't say anything about how to do that, though. It'll pass in a string value called "Link". How do I say "invoke the default browser and have it open Link"?
You can call ShellExecute.
I wrote this method for generic calls, and should works in your case.
procedure ShellOpen(const Url: string; const Params: string = '');
begin
ShellAPI.ShellExecute(0, 'Open', PChar(Url), PChar(Params), nil, SW_SHOWNORMAL);
end;
In your code you should call this
procedure TForm1.LinkLabelClick(Sender: TObject);
begin
ShellOpen(LinkLabel.Caption);
end;
I have all sorts of problems with TLinkLabel that ships with delphi 2010.
a) The control does not render as a hyperlink but as a simple label text on the form. b) the cursor does not change to point out this is a link even though I set the Cursor property. c) the OnLinkClick event does not fire at all.
I am working on windows 7.
So, as far as I am concerned, TLinkLabel does nothing as it should and is useless. ShellExecute is the only solution and must be placed in the OnClick event.
TLinkLabel provides a label that looks like a link. It's your job as the programmer to make it act like a link because only you can know what links are supposed to act like in your program. You wanted the label to automatically open the user's default Web browser using the URL in the label, but that's not the only thing links do. For example:
Internet Explorer is not my default browser, but when I click a link in Internet Explorer, I do not expect the linked page to open in Firefox.
When I click a link in the help program, I expect the linked topic to appear in the help program, not in any Web browser at all.
The preference pages in Eclipse are very complicated. Settings on one page are sometimes related to settings on another page. There are links on those pages that take the user directly to the related page. There is no URL and no HTML involved in this case, and yet they're still labels with underlined text.
Some programs try to offer a choice between opening links in new windows versus re-using old windows. You can't implement that feature without knowing which browser is in use. Your program might offer the user a choice to ignore the default browser setting and always use a specific one. To do that, your UI control can't make too many assumptions about what the program is supposed to do.
I'm guessing you're referring to a TLinkLabel control that comes with Delphi. (My versions don't have such a component.) I imagine that the Delphi control is meant to mimic the one in the .Net class library. It can hold multiple links, and each link can do something different.
If you want a control that always does the shell's default action for URLs, then consider using a different TLinkLabel; the one by Alexander Bach does exactly what you expected. It's from Delphi 3, but it should work unmodified in all later versions as well, including Delphi 2009. If you look at the code, you'll see how it works. It simply calls ShellExecute, as Cesar's answer demonstrates.
LOL, it's funny. So instead of setting crHandPoint as cursor, colored and underlined font and filling the OnClick event to standard TLabel we have component that knows link tag and which at all I need to supply with same On(Link)Click event :))
Only thing it is good for is that it makes easier to embed link into some text and that it is using system style of link...
p.s.: really you have to put Some text with link into the Caption and setup OnLinkClick to that ShellExecute...
I use a control called TInternetLabel instead. It does exactly what you want: on click it opens the browser so you don't have to put code in the OnClick event.
I tried this solution but it still gave problems in Delphi XE4, probably becasue ShellOpen does not understand the HTML-code in the Caption.
What worked for me was a combination of Cesar Romero (the basic code), Adam Feistner (The HTML-code in the Caption) and an older solution:
Put the URL in the HINT field.
Change the line: ShellOpen(LinkLabel.Caption);
to
ShellOpen(LinkLabel.Hint);
This worked for me.

Resources