Need help with Windows programming...

Started by
4 comments, last by Jon 23 years, 11 months ago
My problem is probably very easy to solve but I aint too good with windows programming so here goes: I''m programming in Borland C++ Builder 4 and I''m using alot of my own classes and within one of my window I have an object of my own class, and within that object I have an object of another class. The setup looks like this: BoardWindow->Game->AI. And from the AI-class I would like to access a progressbar located in the windowclass. I guessing windowhandles have something to do with it but I haven''t succeded.
Advertisement
Try looking at it from the other direction. I don''t think it should be the AI object''s responsibility to update a progress bar. Rather, it could simply have a member function that supplies a value. Then the game or window code (whichever owns the progress bar) would call the function and use the value to update the bar.

the Gent
aig
You''ve got a point there but within the AI-class I have a double loop from where I would like run the progressbar and since the program is supposed to be finished in a few days I just don''t have time change everything.
Then you're going to have to either add a member function to the window class that returns a pointer to the progress bar, or a member function that lets you set the value of the progress bar. I recommend the second method. Then from within your AI loop, just call this function with the value.

Are you using MFC (or OWL) for the progress bar, or did you write one yourself?

the Gent

Edited by - An Irritable Gent on May 14, 2000 10:25:51 AM
aig
I''m using Borland Builder so the progress bar is included as a component within Builder, so I have no idea. But i''ll try that second solution. Thanks!
Hello there,
you could store a pointer to the progress bar in your
ai object and update the progress bas as normal from
inside your object.

TProgressBar *pbrProgress = BoardMain->ProgressBar.

in ai routine

pbrProgress->Position = value;

This topic is closed to new replies.

Advertisement