Solved

Emulate mouse click on row in datawindow

Posted on 2006-07-05
9
735 Views
Last Modified: 2013-12-26
Greetings All,

I have some code that selects a row in a datawindow.  It works fine.  But after I select and highlight the row, I want to emulate clicking on that row once.

Can't seem to figure it out.  Here is the code along with a note as to where I want to emulate the click.

dw_2.SelectRow(0,false)
dw_1.reset()

long i
string confo
string confo2
confo2 = em_1.text
//messagebox("confo2 from em_1",confo2)

for i = 1 to dw2retrievedrows
      
      confo = dw_2.getitemstring(i,"compute_3")
      confo = right(confo,4)
      //messagebox("confo and confo2", confo + " " + confo2)
            if confo = confo2 then
                  dw_2.selectrow(i, true)
                  dw_2.SetRow(i)
                  dw_2.scrolltorow(i)
                  dw_2.setfocus()
                                                //emulate mouse click on dw_2 here...

                  return
            end if
      next

Thank you all for your help in advance!!

PEM
0
Comment
Question by:pemurray
  • 4
  • 4
9 Comments
 
LVL 18

Expert Comment

by:diasroshan
Comment Utility
Hi,

i hope u have code written in the DW_2 clicked event... and u can call this code by the following syntax...

dw_2.Triggerevent(Clicked!)


So ur code will look like this...

dw_2.SelectRow(0,false)
dw_1.reset()

long i
string confo
string confo2
confo2 = em_1.text
//messagebox("confo2 from em_1",confo2)

for i = 1 to dw2retrievedrows
     
     confo = dw_2.getitemstring(i,"compute_3")
     confo = right(confo,4)
     //messagebox("confo and confo2", confo + " " + confo2)
          if confo = confo2 then
               dw_2.selectrow(i, true)
               dw_2.SetRow(i)
               dw_2.scrolltorow(i)
               dw_2.setfocus()

                dw_2.Triggerevent(Clicked!)                                //emulate mouse click on dw_2 here...

               return
          end if
     next

Cheers,
Rosh
0
 

Author Comment

by:pemurray
Comment Utility
Hey Rosh,

Okay, I inserted the line as specified:

dw_2.Triggerevent(Clicked!)                                //emulate mouse click on dw_2 here...

And yes, I do have code in my dw_2.clicked event (which automatically retrieves data in dw_1).

I ran the code, but I don't see any difference.  The row is highlighted as before, but it doesn't refresh the data.  Do I have to write a new event or something like that?

Thanks!!

Paul
0
 
LVL 4

Expert Comment

by:Lordain
Comment Utility
Hi Paul,

I can see from what has been posted so far that yes you would highlight a matching row but the problem you are going to run into is you are not telling PB which row you have clicked and you are trying to fire of the clicked event without any parameters.

I believe what is going to actually happen is PB will believe the row = 0.

Are you trying to use the parameters of the clicked event or are you trying to process the clicked event?

Since I am not certain what your actual goal is I can offer some directional advice.

Write a function or user event which will accept the row as an argument and let it do whatever processing you want to carry out.

Therefore replace

dw_2.Triggerevent(clicked!) with

long ll_row
ll_row = dw_2.getrow( )
of_simulate_click(this, ll_row)

Function of_simulate_click(datawindow dw, long row) returns long (or whatever)

//From here you can get any object and/or its data and do whatever you want with it.

----
Otherwise tell me what you are actually trying to do for your clicked event and perhaps I can give you a more specific way of handling what you are trying to accomplish.




0
 

Author Comment

by:pemurray
Comment Utility
Hi Lordain,

Once the code is done with the scrolltorow() where it highlights the correct row in dw_2, I want to emulate a click on dw_2 on the highlighted (selected) row.

I have created some functions, but more along the line of argument a, argument b, return a*b.

So are you defining a function on the fly here or do I have to go into the function painter?

I can paint, but I am not sure what would go into the logic...

Please, whatever is easiest to clickk on the selected row.

Thanks!!

PEM
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 4

Expert Comment

by:Lordain
Comment Utility
Ok but once you emulate the click what are you wanting it to do?  What is in your clicked! event?
0
 

Author Comment

by:pemurray
Comment Utility
Hi Lordain,

I have code in my dw_2 clicked event that I want to fire.  Basically, it does row = dw_2.getclickedrow() and then does a retrieve on dw_1.

Right now the agents are using the software, but they have to look at the row that is highlighted and then click on the highlighted row.  Then the clicked event fires (for that row) and it retrieves the correct information for dw_1.

Thanks for your help!!

PEM
0
 
LVL 4

Accepted Solution

by:
Lordain earned 500 total points
Comment Utility
You have the row number in DW_2 as the variable i from your posted example.  You could just code the following:

dw_1.retrieve( i ) //presuming you are using i as an argument.

No need to fire the clicked event.  I was able to successfully call the clicked! event but all the values are null which I expected it to be null or 0.

This is why I was asking what you were actually trying to accomplish inside the clicked event to determine the requirement to see if there was a better alternative.
0
 

Author Comment

by:pemurray
Comment Utility
BINGO!!

Lordain,

That worked like a charm!!  Very clean solution!!

Thank you, Sir!!

PEM
0
 
LVL 4

Expert Comment

by:Lordain
Comment Utility
Glad to hear and good coding to you.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now