Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Call a procedure from a MDI child in a toolbar frame

8 views
Skip to first unread message

Helenilson

unread,
Jul 8, 2009, 8:47:55 AM7/8/09
to
Can I call a procedure from a MDI child window when i accepted a
toolbar button on the frame? How to implement this?

Andrew Popoff

unread,
Jul 13, 2009, 10:49:54 PM7/13/09
to
On 8 июл, 23:47, Helenilson <helenilson.rica...@gmail.com> wrote:

> Can I call a procedure from a MDI child window when i accepted a
> toolbar button on the frame? How to implement this?

I'm not sure that you really want it :)
What happens if you open the window a few times?

Anyway you can send a message to your MDI Child window from a frame.
You must know the thread of a child window.

It will look something like this:

At Global embeds you must define the global event:

MyEvent EQUATE(EVENT:User + 1)

You must define the global variable or queue to store the threads of
child windows:

MyChildThread LONG

OR

MyChildThreadQueue QUEUE
ThreadNo LONG
END

When child window is opened you must store the thread:

MyChildThread = THREAD()

OR

MyChildThreadQueue.ThreadNo = THREAD()
ADD(MyChildThreadQueue)

When child window closed you must delete the thread:

MyChildThreadQueue.ThreadNo = THREAD()
GET(MyChildThreadQueue,MyChildThreadQueue.ThreadNo)
IF NOT ERRORCODE()
DELETE(MyChildThreadQueue)
END

When you are work with a global variables you need to use a
CriticalSection!!!

At the toolbar button embed:

POST(MyEvent,,MyChildThread)

OR

LOOP j# = 1 TO RECORDS(MyChildThreadQueue)
GET(MyChildThreadQueue,j#)
POST(MyEvent,,MyChildThreadQueue.ThreadNo)
END

At the windows ACCEPT LOOP

IF EVENT() = MyEvent
...DO something
END

I think that is all :)

Helenilson

unread,
Jul 15, 2009, 2:53:29 PM7/15/09
to
Thanks.

I implement like your sugestion.

0 new messages