rch
Gast
|
 |
« Antworten #2 am: 04.08.2002, 14:27:28 » |
|
An example when i use this tecnique is in the open event in a form:
Suppose i have to extract a lot of data from database at the open in my form only (FormCreate event), for example to populate a listbox. I can't see the form until the extraction is completed, but if i could "post" the retrieve, the FormCreate finish because the retrieve is called AFTER, in post mode.
Unfortunatly i can only show an example in PowerBuilder:
FormCreate: . . . // initialize the form... // ...code that init the form...
// --- retrieving data...
// in traditional mode i have to extract data here... MyForm.MyFunctionToExtractData() // or MyForm.Event MyEventToExtractData() // in this way: // 1 init the form // 2 retrieve data // 3 the form become visible
// in post mode i post that in the Window queue... MyForm.Post MyFunctionToExtractData() // or MyForm.Event Post MyEventToExtractData() // in this way: // 1 init the form // 2 the form become visible // 3 retrieve data . . .
I use this "posting" mode also for syncronize some list (Master/Detail): suppose you have 2 list with some rows (in PowerBuilder there are called DataWindow). There is an event (RowFocusChanged) that's fired when i move from a row to an other one in a DataWindow; in this event (on the first list) i can exctract detail data in the second list. If i call the second-list retrieve in syncron-mode each time i move on the first list i have to wait for terminating the second extraction; if i call the second-list retrieve in post-mode i can move in the first list and the retrieve is posted on the Windows queue after the moving.
// Syncron mode: RowFocusChanged event on the first list: DataWindowDetail.Retrieve() // in this way: // 1 i move the focus on new row (but i don't see the change) // 2 retrieve data in second list // 3 i see the focus on new row
// Asyncron mode: RowFocusChanged event on the first list: DataWindowDetail.Post Retrieve() // 1 i move the focus on new row (i see immediately the change!) // 2 retrieve data in second list
In fact this tecnique uses the Windows API PostMessage (asyncron call) instead SendMessage (syncron call); what i want is extend this calling (PostMessage) also for my procedure/function and my event.
Excuse me for my "orrible" english...
Thank you very much...bye
|