Welcome! Log In Create A New Profile

Advanced

Simulate mouseclick on tablecolumn header

Posted by Stefan Bentvelsen 
Stefan Bentvelsen
Simulate mouseclick on tablecolumn header
January 26, 2009 12:58PM
Hi,

in my program I can sort a tablecolumn by hitting the control-key together with a cifer (1, 2, ...). That works OK, except that the sort-icon in the tablecolumn header is not updated. So the small up-arrow and down-arrow stay in the left header corner instead of a bigger up-arrow for a ascending sorted column or down-arrow for a descending sorted column. But if I hoover the mouse over the columnheader, the sort-icon is yet updated.

If I could simulate a mouseclick on a tablecolumn header, I can drop a piece of code AND the sort-icon in de column header could be updated at ones!

Who can give me hints, please?
Louis Verbraak
Re: Simulate mouseclick on tablecolumn header
January 26, 2009 02:37PM
Hello Stefan,

I use this procedure to get the result you want. It isn't necesary to click the column but just hoover the title of the table. As I mention in my remarks (dutch), it will not work when the mousecursor is outside your application.

// Om te forceren dat het sorteerteken wordt weergegeven in de juiste kolom, dient de muiscursor
// over de titelbalk van de zoektabel te worden geplaatst.
// Dit werkt niet wanneer de muiscursor buiten het hoofdscherm staat!
PROCEDURE gwpSorteerKolomWeergeven()
LOCAL
liMouseXPos is int
liMouseYPos is int
liMouse is int

// Onthoudt originele positie van de cursor.
liMouse=CursorPos(cpScreen)
liMouseXPos=LoWord(liMouse)
liMouseYPos=HiWord(liMouse)
// Plaats de cursor buiten het scherm.
liMouse=CursorPos(cpScreen,-1,-1)
// Plaats de cursor op de titelbalk van de zoektabel.
liMouse=CursorPos(cpClient,10,10)
Multitask(1)
// Wanneer de muis origineel buiten de zoektabel stond (links of boven), eerst de muis nog even verplaatsen binnen de zoektabel.
IF liMouseXPos<0 _OR_ liMouseYPos<0 THEN
liMouse=CursorPos(cpClient,100,100)
Multitask(1)
END
// Plaats de cursor op de originele positie.
liMouse=CursorPos(cpScreen,liMouseXPos,liMouseYPos)


HTH.
Stefan Bentvelsen
Re: Simulate mouseclick on tablecolumn header
January 26, 2009 04:42PM
Hi Louis,

works perfect. Thanks for helping.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: