Solved

Emulate mouse click on row in datawindow

Posted on 2006-07-05
9
746 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
ID: 17048412
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
ID: 17049994
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
ID: 17053087
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:pemurray
ID: 17055375
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
 
LVL 4

Expert Comment

by:Lordain
ID: 17055812
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
ID: 17063365
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
ID: 17063455
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
ID: 17063730
BINGO!!

Lordain,

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

Thank you, Sir!!

PEM
0
 
LVL 4

Expert Comment

by:Lordain
ID: 17064779
Glad to hear and good coding to you.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

808 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