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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call a button click event in a form from a PRG

Status
Not open for further replies.

thegame8311

Technical User
Jan 6, 2012
133
US
I was wonder, if there is a way to call a button click event in a form, from a PRG. I Read somewhere about Read Events but I am not if that is the way to go about it, much less not really understanding what Read Event are
 
Yes, perhaps Mike Gagnon actually is talking about a PRG containing DEFINE CLASS, otherwise - Tamar - how would such a PRG compile to a COM+ dll usable in/as a service, webservice or webapplication? COM needs OLEPUBLIC and that is only available to classes, not procedures or functions.

If so, the file being a PRG is not what matters here, we think along the same lines.

It just shifts the encapsulation or adds another encapsulation. It doesn't contradict the kind of encapsualtion you should have in each object to be able to function. You always have some dependencies, too, otherwise encapsulation would lead to one monolithic thing, which is also not what you want.

Bye, Olaf.
 
ok, well my idea is to run an update, so would it be easier to do all of that from a prg?

and if that is the better idea then I can put the call to the prg in a menu option and do it that way?
 
Doing an update? of what? application itself? data? The form? Are you actually meaning a refresh of the form?

Could you be more specific?

Bye, Olaf.
 
sorry, I mean of the data, there are a few tables that contain data that is pulled from the web, but since it can change on a day to day or hour to hour basis, I want my application to have way to have the user do an update that will update all the necessary tables. Currently I am doing this from a form, but if I use a prg instead, and then call that from a menu item, then that would be awesome
 
OK,

so the question actually is, if you can call a prg from a menu item, too, instead of a form?

That is a simple yes.

What Do you not understand in the menu designer or the ON SELECTION BAR command? You can call whatever you want as [Command]. That can be DO FORM or DO some.prg or a function() call or Execscript() or whatever you like.

But why do you ask about calling a button click from a PRG, then?

Bye, Olaf.
 
Well I was trying to automate a button click without going to the form, and did not clearly realize what I actual idea was. But now that I have more understanding it's all starting to come together even though I have been quite vague among other things when asking my questions, but I do appropriate all of the help everyone has offered me
 
it's quite impossible to click a button not existing, isn't it?

And puting that code into a menu item procedure would also not be a good solution.

As always with such things you only want to program once and use at several places, you do need to move the code to some central place, eg a prg and call that both from the menu item and the button.

More elegant than a PRG would be a central object, eg an instance of an application class you instanciate at start of the application, eg:

Public goApp
goApp = Newobject("gameapplicationclass","application.vcx")

Then this could have a method syncgameserverdata() and you'd call goApp.syncgameserverdata() both from the menu item and from the form button click() event.

A syncgameserverdata() would not be a typical method in such an application class and perhaps you'd rather have a seperate component datasynch, eg as goApp.datasynch and call it by goApp.datasynch.getgameserverdata()

goApp should start with having some global definitions, eg a property applicationname and version. Then all captions etc could refer to goApp.applicationname, version and other stuff you can change centrally.

Well, that's one major oop thought, isn't it? Do once, use multiple times.

Bye, Olaf.
 
True do it once, and reuse. I first have to learn about the classes, then I will understand you answer better Olaf
 
Tamar

The OP's requirements are obviously not what I was trying to put out there. All I want to say is I do put the behavior and the business end of a form in a separate prg (using a OLE public class)

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top