Sublime Forum

How to pass location parameters in view.show_popup()

#1

@OdatNurd @FichteFoll @deathaxe

Documentation says
The default location of -1 will display the popup at the cursor, otherwise a text point should be passed.
I tried to pass tuple to the location parameter but it didn’t work for me.

How to make sure that every time when Html popup is opened at the same location? In what form we have to pass the location related paramenters ?

1 Like

#2

point is an int. the location is just a variable name I guess.

0 Likes

#3

@jfcherng
Can you please provide me any example as I’m still unable to understand it.
What if I want to open my popup on almost right hand side of editor window, what will be the values that I need to pass to location parameter ?

1 Like

#4

The point means the nth position (i.e., the nth char) in your file (or buffer if unsaved). “almost right hand side of editor window” sounds vague to me.

0 Likes

#5

I tried it but this is text based location specific only
view.show_popup(b,location=view.text_point(10, 1))

I pinpoint at fix location. Could you suggest the actual parameters for it?

0 Likes

#6

What actual parameters…? You have to calculate the position by yourself somehow depending on “almost right hand side of editor window”. It may involve layout things which I am not familiar with, so I cannot help that.

0 Likes

#7

FYI, you don’t need to mention me or anyone of these three people. I read every post anyway and a mention doesn’t make me do that faster. Besides, there are many more helpful people on here.

It’s mostly a matter of how your question or problem is formulated and how much someone needs to ask questions to understand what it actually is that you want to know or struggle with, because that takes the most time.

1 Like

#8

oh, so it’s not possible to put a popup in the bottom-right corner of an empty buffer since it’s always tied to a text position?

0 Likes

#9

No. And the direction of the popup is determined by ST itself.

1 Like

#10

Thanks for a prompt response!

(what a limited API, you can’t style it properly as many html position properties are missing, and you can’t even position it properly) :frowning:

0 Likes

#11

The closest you can get is an annotation these days, which I think sit on the right hand side somewhere on whichever text line you specify. So potentially if the view is scrolled in such a way that the viewport is full of lines (i.e. not scrolled past end) then it should be possible to have something appear roughly where you might want…

0 Likes