PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD17] Popup window on a Table
[WD17] Popup window on a Table
Iniciado por guest, 20,mar. 2015 03:04 - 3 respuestas
Publicado el 20,marzo 2015 - 03:04
Hi
I have a table with 5 columns visible. If the user right clicks in the first column I would like a window to popup at the right margin of that column. I therefore have a button off the screen, linked to the Right Mouse click in the column, which fires up the popup.

OpenPopupPosition does not recognise the individual columns/rows of the table so I can't use that. I therefore thought I would use OpenChildor OpenSister with the X & Y positions stipulated. The problem I have is finding the position of the right margin of the column. I can get the position where the mouse click appears easily enough but of course this can be anywhere in that column & I don't want my popup to obscure that data.

The window which contains the table is an MDI child window so I thought MDIParent..X + Window..X + Table..X + ColumnWidth should get me pretty close but it's not. Ignoring column width I'm approx 250 pixels short. As pretty well everything can be moved around, resized etc I have to code this dynamically or at least know why I'm out 250 pixels & that it will be constant.

Anyone have any ideas what I'm missing or if there's an easier way to do this?

Thanks

David
Publicado el 20,marzo 2015 - 07:27
Well, I've got a work around but if anyone has any better ideas I'd be pleased to hear them.

I'm using CursorPos to give me the X & Y coordinates & then TableInfoxy to give me the column & row in the table where the mouse click originated. I've simply added the column width to the X coordinate & then run a loop backwards from that to X with TableInfoxy giving me the column no. on each iteration. As soon as the column is the same as my 'mouse click' column I break out of the loop. Not particularly elegant but it does work!

David
Miembro registrado
31 mensajes
Publicado el 20,marzo 2015 - 12:21
Nice solution! That's about what I would do.

Now, what if the User makes the columns wider and then makes the Window smaller so that the table's horizontal scrollbar shows... and let's say the user scrolls that horizontal scrollbar a bit of a ways -- does the popup still pop up in the correct position?
Publicado el 20,marzo 2015 - 14:52
Hi David,

Could you use TableSelect? This function recognises table column subscripts using tsColumn?