Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MouseMoveRow

Status
Not open for further replies.

cagiv

Programmer
Mar 5, 2009
56
DE
Hello all,

How do you take advantage of PROPLIST:MouseMoveRow? I want to highlight rows in the listbox (C6) as the mouse moves over them.

PROPLIST:MouseMoveRow works on a listbox when you click, but on its own, PROPLIST:MouseMoveRow doesn't seem to generate any event, even with the Imm attribute on the listbox. I can put a region over the listbox, and it will
generate a MouseMove event, but now the region has focus, and not the listbox, and PROPLIST:MouseMoveRow does not seem to work.

How do I get an event with which to interrogate PROPLIST:MouseMoveRow?

Best regards

 
Hi!

Your only option is to ::

1) store the co-ordinates of the list box
2) identify the number of rows
3) from the MOUSEX & MOUSEY functions identify the row number and highlight it.

Check the example I did a long time back to change the style of the cell and the column cursor when over the header.


Regards
 
Hi ShankarJ,

very thanks for your help. I will try to understand your code and use it for my app.


Best regards
 
Hi!

Run the Cursor.EXE first to understand what the program does and that will make understanding the code easier.

Regards
 
Hi ShankarJ,

yes i did it, very nice. For me, the hardest part to understand is the routine "SetStyle" :)

Best regards
 
Hi!

There are two Routines that are used ::

SetColCoords - This routine stores the X & Y coordinates of the column i.e. assuming the column to be a rectangle, it stores the top left X/Y and bottom right X/Y. This is required for me to identify which column is under the mouse.

SetStyle - In this program highlighting is done by changing the style number of the cells. For this, ALL columns in the List Box needs to have the Style ticked and Color un-ticked. Style is a easier way to changing the Font/Color of cells as it add one extra column for every styled column in the queue. Using Color would add 4 extra columns for very styled columns. SetStyle ASSUMES that every column in the listbox is Styled and so every other column would be the style variable as shown in the Queue below ::

Code:
ID                   LONG                                  !
ID_Style             BYTE                                  !
Date                 LONG                                  !
Date_Style           BYTE                                  !
Comment              STRING(20)                            !
Comment_Style        BYTE                                  !

In the routine ::

Code:
  IF LastRow AND LastCol
     GET(RecQ, LastRow)  --> get the row
     IF NOT ERRORCODE()
        F# = ?List{PROPLIST:FieldNo, LastCol} + 1 --> get the column and add one to it so that it points to the Style variable

        A &= WHAT(RecQ, F#)  -- reference the Style variable
        IF NOT A &= NULL
           A = StyleNo  --> assign the Style

           PUT(RecQ)  --> update the queue
        END
        A &= NULL
     END
  END

You could write the same routine in a non-generic fashion as ::

Code:
  IF LastRow AND LastCol
     GET(RecQ, LastRow)
     IF NOT ERRORCODE()
        EXECUTE LastCol
          ID_Style      = StyleNo
          Date_Style    = StyleNo
          Comment_Style = StyleNo
        END

        PUT(RecQ)
     END
  END

I hope it is clearer.

Regards
 
HI ShankarJ,

thanks again, it works fine. But something i dont understand.
In my list i use a Queue:RADSQLBrowse with data from oracle-table. In the queue are not extra fields for style, but it works. Where will it save on

IF NOT A &= NULL
A = StyleNo
PUT(Queue:RADSQLBrowse)
END

Regards
 
Hi!

In my list i use a Queue:RADSQLBrowse with data from oracle-table. In the queue are not extra fields for style, but it works.

I don't understand - How does it work without styles?

Where will it save on

IF NOT A &= NULL
A = StyleNo
PUT(Queue:RADSQLBrowse)
END

As I said in my post, I am ASSUMING that every column if followed by a Style variable in the queue and hence I update the NEXT variable in the Queue after the Column. If you do not have Style variables, the above code will be changing the value of your data and that is DANGEROUS.

If you do not have Style variables in the queue, you could use PROPLIST:BackColor, PROPLIST:BackSelected, PROPLIST:TextSelected or PROPLIST:TextColor in the following manner ::

?List {PROPLIST:TextColor, LastCol} = COLOR:Red

Post your code or e-mail me at <j s h a n k a r @ e i m . a e> with your code for more detailed help.

Regards
 
Hi ShankarJ,

with ?List {PROPLIST:TextColor, LastCol} = COLOR:Red
the complete col will be red. I want it only on field or better on row.

I have the problem too, that the cursor is 1 line under the field which is styled.

I think, i have to code it new on weekend, to understand your code completly. With some PROP's i did not work ever. I have to read in Help...

Thanks for your help
 
Hi!

Use Styles for all the columns.

You can change your query to return 0 for the styles i.e. to populate the queue shown below ::

ID LONG !
ID_Style BYTE !
Date LONG !
Date_Style BYTE !
Comment STRING(20) !
Comment_Style BYTE !

the SQL query can be ::

SELECT ID, 0, Date, 0, Comment, 0 FROM MyTable ...

Regards
 
Hi ShankarJ,

sorry for my late answer.
I have code it new to understand your programm.
Now the hole row is styled on mouseover. I solved it with an loop in setstyle-routine. Futhermore the cursor is now on the right row, a small change in computation. Curious thats only in my app. But now it's ok.

Thanks for your help.
Best Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top