You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
CASE %WM_COMMAND
SELECT CASE CBCTL
CASE %IDC_List
CASE %IDCANCEL
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN '
DIALOG END CBHNDL, 0
FUNCTION=1
END IF
When you get WM_COMMAND/IDCANCEL, there is no BN_CLICKED notification and CBCTLMSG never equals one.
That is, when you get WM_COMMAND/IDCANCEL, escape was pressed regardless of other conditions.
In ShowFrmListProc I can elect to click the button with an ID of %IDC_CREATEMergeDataFILE
ShowWaiting dialog opens with a progress bar
CreateMergeDataFile then runs my routine and updates the progress bar
How can I stop this routine prematurely when pressing the ESC key?
You may have a few suggestions for the MODELESS ShowWating dialog!!
Which is a global long variable to say which database to used.
Thanks
Ian
FUNCTION CreateMergeDataFile(hDlg AS LONG) AS LONG
LOCAL a AS LONG
LOCAL n AS LONG
LOCAL hList1 AS LONG
LOCAL items AS LONG
LOCAL szBuf1 AS ASCIIZ * %BUF_SIZE
LOCAL txt AS STRING
OPEN netdir+"MergeData.txt" FOR OUTPUT AS #2
txt="Title"+$TAB+"First Name"+$TAB+"Last Name"+$TAB+"Job"+$TAB+"Company"+$TAB+"Street1"+ _
$TAB+"Street2"+$TAB+"Street3"+$TAB+"City"+$TAB+"State"+$TAB+"Post Code"+ _
$TAB+"Country"+$TAB+"Telephone"+$TAB+"Fax"+$TAB+"E-Mail"+$TAB+"Telephone2"+ _
$TAB+"Notes1"+$TAB+"Notes2"+$TAB+"Notes3"+$TAB+"ContactID"
PRINT #2, txt
SELECT CASE which
CONTROL HANDLE hDlg, %LVW_SYSLISTVIEW32 TO hList1
Items=ListView_GetItemCount(hList1)
CONTROL SEND hPleaseWait, %IDC_MSCTLS_PROGRESS32_2, %PBM_SETRANGE, 0, MAKDWD(0, Items)
CASE %MRMAccount TO %MRMMemoPopup
FOR a=0 TO items-1
CONTROL SEND hPleaseWait, %IDC_MSCTLS_PROGRESS32_2, %PBM_SETPOS, a, 0
ListView_GetItemText hList1, a, 5, szBuf1, SIZEOF(szBuf1)
PRINT #2, MRMSQLGetRecord(BYCOPY szBuf1)
NEXT a
CLOSE
MSGBOX "MRM database"+$CRLF+"New MergeData File Created - "+_
netdir+"MergeData.txt", %mb_taskmodal, $ApplName
CASE ELSE
OPEN netdir+FileName FOR RANDOM AS #1 LEN = LEN(AddressDet)
FOR a=0 TO items-1
CONTROL SEND hPleaseWait, %IDC_MSCTLS_PROGRESS32_2, %PBM_SETPOS, a, 0
ListView_GetItemText hList1, a, 5, szBuf1, SIZEOF(szBuf1)
GET #1, VAL(szBuf1), AddressDet
PRINT #2, AddressLineDetails
NEXT a
CLOSE
MSGBOX "None MRM database"+$CRLF+"New MergeData File Created - "+_
netdir+"MergeData.txt", %mb_taskmodal, $ApplName
END SELECT
END FUNCTION
CALLBACK FUNCTION ShowFrmListProc()
LOCAL Items AS LONG
LOCAL n AS LONG
LOCAL First AS LONG
LOCAL hList1 AS LONG
LOCAL a AS LONG
LOCAL szBuf1 AS ASCIIZ * %BUF_SIZE
LOCAL pNmLv AS NM_LISTVIEW PTR
LOCAL Result AS LONG
SELECT CASE CBMSG
CASE %WM_NCACTIVATE
' CASE %WM_KEYDOWN
' msgbox "keydown"
CASE %WM_INITDIALOG
DIALOG SEND CBHNDL, %WM_SETICON, %ICON_BIG, hIcon
CASE %WM_NOTIFY
CASE %WM_COMMAND
SELECT CASE CBCTL
CASE %IDC_List
CASE %IDCANCEL
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
DIALOG END CBHNDL, 0
FUNCTION=1
END IF
CASE %IDC_CREATEMergeDataFILE
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
ShowWaiting 0, "Creating Merge Data File"
CreateMergeDataFile CBHNDL
FUNCTION=1
DIALOG END hPleaseWait, 0
END IF
END SELECT
END SELECT
END FUNCTION
FUNCTION ShowWaiting(BYVAL hParent AS DWORD, Message AS STRING) AS LONG
LOCAL lRslt AS LONG
LOCAL Count AS DWORD
#PBFORMS BEGIN DIALOG %IDD_Waiting->->
LOCAL hDlg AS DWORD
LOCAL hFont1 AS DWORD
DIALOG NEW hParent, "Please Wait", 218, 156, 143, 58, %WS_POPUP OR _
%WS_SYSMENU OR %WS_BORDER OR %WS_DLGFRAME OR %WS_CLIPSIBLINGS OR _
%WS_VISIBLE OR %DS_MODALFRAME OR %DS_CENTER OR %DS_3DLOOK OR _
%DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_WINDOWEDGE OR _
%WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
%WS_EX_RIGHTSCROLLBAR, TO hDlg
CONTROL ADD LABEL, hDlg, %LBL_Message, "", 1, 5, 142, 31, %WS_CHILD OR _
%WS_VISIBLE OR %SS_CENTER, %WS_EX_LEFT OR %WS_EX_LTRREADING
CONTROL ADD "msctls_progress32", hDlg, %IDC_MSCTLS_PROGRESS32_2, _
"msctls_progress32_2", 0, 39, 143, 15, %WS_CHILD OR %WS_VISIBLE OR _
%WS_BORDER
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: