John, if you look at my code sample, you will see that I tried the DIALOG DOEVENTS after each CONTROL ADD, but it did not work.
If I ADD all of the labels at the beginning and use CONTROL SET TEXT, it works fine, but I was suprised that the CONTROL ADD does not take effect immediately.
------------------
Bernard Ertl
Announcement
Collapse
No announcement yet.
Please clue me in....
Collapse
X
-
I've also used:
DIALOG SHOW MODELESS
DIALOG DO EVENTS
after control add or control send operations.
I don't know what efficiency is, but don't really care for most
I/O to screen anyway.
------------------
Thanks,
John Kovacich
Leave a comment:
-
-
OK. Thanks Edwin, I'll give it a try.
------------------
Bernard Ertl
Leave a comment:
-
-
Please clue me in....
I was experimenting with a simple data access test program and came across a puzzle (for me at least). The following code displays a blank dialog and will not add the label controls to it until the MSGBOX statement at the end. I've tried using the each of the three statements that are commented out under each CONTROL ADD statement, but none of them worked. How can I get the dialog to resfresh and show the labels when they are added?
#COMPILE EXE
#REGISTER NONE
#INCLUDE "DDT.INC"
#INCLUDE "MYTYPES.INC"
%MaxElem = 100000
%MaxOffset = %MaxElem - 1
%MaxIterations = 4000
FUNCTION PBMAIN () AS LONG
REGISTER I&, J&
LOCAL Start!, Fin!, temp??, hDlg&
LOCAL Start2!, Fin2!, udtsize&
LOCAL Start3!, Fin3!
LOCAL Start4!, Fin4!
LOCAL Start5!, Fin5!
DIALOG NEW 0, "UDT Access Test", ,, 270, 112, TO hDlg&
DIALOG SHOW MODELESS hDlg&
DIM buff2 ( 1: %MaxElem) AS DWORD
Start! = TIMER
FOR J& = 1& TO %MaxIterations
FOR I& = 1& TO %MaxElem
temp?? = buff2(I&)
NEXT
NEXT
Fin! = TIMER
CONTROL ADD LABEL, hDlg&, -1, "Accessing DWORD array took"+STR$(Fin!-Start!)+" seconds.", 10, 10, 250, 12,
' DIALOG DOEVENTS
' DIALOG SHOW STATE hDlg&, %SW_SHOW
' DIALOG SHOW MODELESS hDlg&
DIM irptr AS DWORD PTR
Start4! = TIMER
irptr = VARPTR(buff2(1))
FOR J& = 1& TO %MaxIterations
FOR I& = 0& TO %MaxOffset
temp?? = @irptr[I&]
NEXT
NEXT
Fin4! = TIMER
ERASE buff2
CONTROL ADD LABEL, hDlg&, -1, "Accessing DWORD array with pointer took"+STR$(Fin4!-Start4!)+" seconds.", 10, 30, 250, 12,
' DIALOG DOEVENTS
' DIALOG SHOW STATE hDlg&, %SW_SHOW
' DIALOG SHOW MODELESS hDlg&
DIM buff( 1: %MaxElem) AS MY_UDT_TYPE
Start5! = TIMER
FOR J& = 1& TO %MaxIterations
FOR I& = 1& TO %MaxElem
temp?? = buff(I&).ir
NEXT
NEXT
Fin5! = TIMER
CONTROL ADD LABEL, hDlg&, -1, "Accessing UDT array took "+STR$(Fin5!-Start5!)+" seconds.", 10, 50, 250, 12,
' DIALOG DOEVENTS
' DIALOG SHOW STATE hDlg&, %SW_SHOW
' DIALOG SHOW MODELESS hDlg&
udtsize& = SIZEOF(buff(1))
Start2! = TIMER
FOR J& = 1& TO %MaxIterations
irptr = VARPTR(buff(1).ir)
FOR I& = 1& TO %MaxElem
temp?? = @irptr
irptr = irptr + udtsize&
NEXT
NEXT
Fin2! = TIMER
CONTROL ADD LABEL, hDlg&, -1, "Accessing UDT array with DWORD element pointer took "+STR$(Fin2!-Start2!)+" seconds.", 10, 70, 250, 12,
' DIALOG DOEVENTS
' DIALOG SHOW STATE hDlg&, %SW_SHOW
' DIALOG SHOW MODELESS hDlg&
DIM udtptr AS MY_UDT_TYPE PTR
Start3! = TIMER
udtptr = VARPTR(buff(1))
FOR J& = 1& TO %MaxIterations
FOR I& = 0& TO %MaxOffset
temp?? = @udtptr[I&].ir
NEXT
NEXT
Fin3! = TIMER
CONTROL ADD LABEL, hDlg&, -1, "Accessing UDT array with pointer took"+STR$(Fin3!-Start3!)+" seconds.", 10, 90, 250, 12,
' DIALOG DOEVENTS
' DIALOG SHOW STATE hDlg&, %SW_SHOW
' DIALOG SHOW MODELESS hDlg&
MSGBOX "Done!",,"UDT Access Test"
DIALOG END hDlg&, 0
' MSGBOX "Accessing DWORD array took"+STR$(Fin!-Start!)+" seconds." + $CRLF + $CRLF + _
' "Accessing DWORD array with pointer took"+STR$(Fin4!-Start4!)+" seconds." + $CRLF + $CRLF + _
' "Accessing UDT array took "+STR$(Fin5!-Start5!)+" seconds." + $CRLF + $CRLF + _
' "Accessing UDT array with DWORD element pointer took "+STR$(Fin2!-Start2!)+" seconds." + $CRLF + $CRLF + _
' "Accessing UDT array with pointer took"+STR$(Fin3!-Start3!)+" seconds." + $CRLF + $CRLF _
' ,,"UDT Access Test"
END FUNCTION
------------------
Bernard ErtlTags: None
-
Leave a comment: