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.
After clicking a button that pops up another window and dismissing the window the button retains a small thin black line around the control like WS_BORDER puts there but it was not created with that style. Is there a way to get rid of it. Can you do a control send to the button control to remove a style?
After clicking a button that pops up another window and dismissing the window the button retains a small thin black line around the control like WS_BORDER puts there but it was not created with that style. Is there a way to get rid of it. Can you do a control send to the button control to remove a style?
To give more info this button is a superclassed button that calls a dialog with a 3 month ms calendar control. The calendar control is on a dialog that has several shortcut buttons that return codes like BOM/EOM (beginning of the current month, end of the current month). Clicking a date or one of the shortcut buttons returns either a date or a code for BOM/EOM to a buddy textbox. The button superclass then sets focus to the Date textbox, calls a function to validate the date and moves to the next field using SetFocus. It then does an Exit Function. Works fine except for the left over rim around the 12x12 button.
Probably serves me right for doing some much in a Superclass.
I tried remarking out the EXIT FUNCTION and it just stayed focus on the button and didn't move to textbox and finish it's work. Here is the pertinent code.
Code:
CALLBACK FUNCTION NDateButtonProc
STATIC OldProc AS LONG, OffsetWndExtra AS LONG
LOCAL Txt AS ASCIIZ * %MAX_PATH, sTxt AS STRING
LOCAL DateButtonID AS LONG, DateID AS LONG, DescID AS LONG
LOCAL DateHandle AS LONG
IF CBHNDL = 0 THEN OldProc = CBWPARAM: OffsetWndExtra = CBLPARAM: EXIT FUNCTION
DateButtonID& = getdlgctrlid(CBHNDL)
DateID& = DateButtonID& - (scr_NUM_FLD# * 2 )
DateHandle& = GetDlgItem(GetParent(CBHNDL),DateID&)
SELECT CASE CBMSG
CASE %WM_LBUTTONDOWN
Call SupDateGetDate() 'CALLS A DIALOG that contains a calendar control and buttons for date codes
Txt = V_DateStr
SetWindowText DateHandle&,Txt
sTxt = NEditDateFormat(DateHandle&) ' translates any codes returned to real dates (BOM - beginning of month etc)
SetWindowText DateHandle&, BYCOPY sTxt
SetFocus GetNextDlgTabItem(GetParent(CBHNDL), DateHandle&, 0)
'EXIT FUNCTION
END SELECT
FUNCTION = CallWindowProc(OldProc, CBHNDL, CBMSG, CBWPARAM, CBLPARAM)
END FUNCTION
That border might be a result of the BS_DEFPUSHUTTON style (vs BS_PUSHBUTTON)
BS_DEFPUSHBUTTON
Creates a push button that behaves like a BS_PUSHBUTTON style button, but also has a heavy black border. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.
I seem to recall something like, if you don't make one of your buttons this style, Windows does it for you. But you can change it with the BM_SETSTYLE message.
But I cannot find this in my SDK doc this AM; maybe you will have better luck.
Thanks, Michael. Using the %BM_SETSTYLE returned the button to it's non-focused look and I could retain the code I was using without resorting to keybd_event.
Code:
CALLBACK FUNCTION NDateButtonProc
STATIC OldProc AS LONG, OffsetWndExtra AS LONG
LOCAL Txt AS ASCIIZ * %MAX_PATH, sTxt AS STRING
LOCAL DateButtonID AS LONG, DateID AS LONG, DescID AS LONG
LOCAL DateHandle AS LONG
IF CBHNDL = 0 THEN OldProc = CBWPARAM: OffsetWndExtra = CBLPARAM: EXIT FUNCTION
DateButtonID& = getdlgctrlid(CBHNDL)
DateID& = DateButtonID& - (scr_NUM_FLD# * 2 )
DateHandle& = GetDlgItem(GetParent(CBHNDL),DateID&)
SELECT CASE CBMSG
CASE %WM_LBUTTONDOWN
Call SupDateGetDate()
Txt = V_DateStr
SetWindowText DateHandle&,Txt
sTxt = NEditDateFormat(DateHandle&)
SetWindowText DateHandle&, BYCOPY sTxt
SetFocus GetNextDlgTabItem(GetParent(CBHNDL), DateHandle&, 0)
SendMessage CBHNDL, %BM_SETSTYLE, %BS_PUSHBUTTON, %TRUE
EXIT FUNCTION
' keybd_event %VK_TAB, MapVirtualKey(%VK_TAB, 0), 0, 0: Sleep 0 'key_down msg
' keybd_event %VK_TAB, MapVirtualKey(%VK_TAB, 0), %KEYEVENTF_KEYUP, 0: Sleep 0 'key_up msg
' keybd_event %VK_TAB, MapVirtualKey(%VK_TAB, 0), 0, 0: Sleep 0 'key_down msg
' keybd_event %VK_TAB, MapVirtualKey(%VK_TAB, 0), %KEYEVENTF_KEYUP, 0: Sleep 0 'key_up msg
END SELECT
FUNCTION = CallWindowProc(OldProc, CBHNDL, CBMSG, CBWPARAM, CBLPARAM)
END FUNCTION
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.
Comment