Jump to content

[SOLVED] Writing a lua function for scite ...


Recommended Posts

I'm trying to write a lua function that will pop up a calltip for whenever the user hovers their mouse over a function. This is what I have so far:

function myCallTips:OnDwellStart(position, word)
    print(word)
    return true
end

But this doesn't seem to work. No print statements are executed. Do you have any ideas as to why this shouldn't work? If so, please share them.

Edit:

I just found this:

SCI_SETMOUSEDWELLTIME(int milliseconds)

SCI_GETMOUSEDWELLTIME

These two messages set and get the time the mouse must sit still, in milliseconds, to generate a SCN_DWELLSTART notification. If set to SC_TIME_FOREVER, the default, no dwell events are generated.

Let me experiment and I'll get back to you.

Edit:

Tried this:

function myCallTips:OnOpen()
    scite.SendEditor(SCI_SETMOUSEDWELLTIME, 300)
end

function myCallTips:OnDwellStart(pos, word)
    print("OnDwellStart")
    scite.SendEditor(SCI_CALLTIPSHOW, 0, word)
end

function myCallTips:OnDwellEnd()
    print("OnDwellEnd")
    scite.SendEditor(SCI_CALLTIPCANCEL)
end

Sadly, I can't get it to work right.

Edited by LaCastiglione
Link to comment
Share on other sites

Not sure how you got your code setup on your side, but ...

1) Linking those function up to AutoIt3SciTELUASciTEStartup.lua

2) renaming 'myCallTips:' to 'AutoItTools:' in your code.

3) save + scite restart, just in case.

4) open (not switching to) a au3 file.

Its displaying the word under the cursor as tooltip on my side.

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

OnDwellStart isn't called for some reason and I don't know why. Something may have changed in SciTE since I wrote the Event class. Maybe one of these days I'll remember to take a look as the feature sounds kind of interesting and I'm surprised I didn't think of it before.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...