en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en nl en en en en en en de en en nl en en en en en en en en en en en en en nl en en en en en en en en en en nl en en en en en en en en en en en fr en en en en nl en en en en en en en en en en nl en en fr en en en en en en en en en en en nl vi en en en en en en en it en en en en nl en en en en en en it it en en en en en en en en de en en en fr en en en en en en en en en pt en en en en en en
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in PowerBASIC for Windows only
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.
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
I know there was an example or article posted sometime ago about subclassing and I would like to learn how to do it. I looked for it earlier but wasn't able to find it. Maybe I didn't go far enough back. I want to just simply learn how to subclass ddt controls in general. If someone knows the url for that,would you be so kind as to let me know what that is?
21 Feb 2000, 06:00 PM
Never mind y'all, I found Lance's example on subclassing an edit control in a ddt window.
Join Date: Aug 1998
23 Feb 2000, 08:11 AM
Where did you locate Lance's example? I cannot find it.
23 Feb 2000, 11:50 AM
i had to dig way back for this:
it's a pretty straight forward example and i had no problem adapting it to fit my needs. have fun.
[this message has been edited by adam ritchie (edited february 23, 2000).]
Join Date: Sep 1999
23 Feb 2000, 12:18 PM
as i remember, lance' sample is for subclassing alone edit control.
if you want to subclass whole ddt' window, look http://www.powerbasic.com/support/pb...ad.php?t=12662
up to now, lance didn't post information that it's not correct to replace dialog doevents by described way.
23 Feb 2000, 02:42 PM
It is still a good example of subclassing in general and that is what I wanted. I had already investigated that link before I checked out Lance's example. I have been able to adapt it to work with any control I need it for. It depends on what Bruce wants to do - subcalss the whole window or just a control(s). I haven't tried it on the whole window yet(at this point I don't need to).
Join Date: Aug 1998
23 Feb 2000, 03:11 PM
Thanks Adam & Seman
This should do it. Thanks again
Join Date: Aug 1998
23 Feb 2000, 03:15 PM
Here's my sample of how to subclass an edit control so that only the letters A-F and 0-9 may appear. (representing Hex values of course!)
'Create a DDT edit box, labeled %IDTEXT1 'In main dialog procedure: Case %WM_INITDIALOG ' Subclass the edit control Control Handle CbHndl, %IDTEXT1 To hEdit& gOldSubClassProc = SetWindowLong(hEdit&, %GWL_WNDPROC, CodePtr(SubClassProc)) Case %WM_DESTROY ' Important! Remove the subclassing SetWindowLong hEdit&, %GWL_WNDPROC, gOldSubClassProc Function = 0 Exit Function 'Now the subclass procedure: 'Not 100% sure this is all accurate, but it does work...:-) '------------------------------------------------------------ Function SubClassProc(ByVal hWnd&, ByVal wMsg&, ByVal wParam&, ByVal lParam&) As Long Local NewChar As Asciiz * 2 Local Y As Long Local zText As Asciiz * 13 Local yMsg As Long ' Process our messages in this subclass procedure Select Case wMsg& Case %WM_KEYDOWN yMsg = LoWrd(wParam&) 'Actual ascii value of keystroke coming in Select Case yMsg Case 8,48 To 57, 65 To 70, 97 To 102 ' do nothing Case 35,36,37,39,40,46 ' do nothing ' Left arrow = 37 ' Right arrow = 39 ' home = 36 ' Down = 40 ' Up = 38 ' End = 35 Case Else Function = %NULL Exit Function End Select Case %WM_CHAR yMsg = LoWrd(wParam&) 'Actual ascii value of keystroke coming in Select Case yMsg Case 8 'BackSpace Case 48 To 57 ,65 To 70 Case 97 To 102 'a-f Case Else Function = %NULL Exit Function End Select Case %WM_KEYUP Control Get Text hDlg, %IDTEXT1 To St If Len(St) = 12 Then Control Enable hDlg, %IDSWAP Else Control Disable hDlg, %IDSWAP End If End Select ' Pass the message on to the original window procedure... the DDT engine! Function = CallWindowProc(gOldSubClassProc, hWnd&, wMsg&, wParam&, lParam&) End Function '-------------------------------------------------------------------------------
True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 10:45 PM.
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.