Greek letters in a text box

rex64
04-02-2006, 10:44 AM
What does it take to make a VB6 text box support Greek letters? My text box supports Spanish, so I was very surprised when I found out it does not support Greek. Do I just need to make it Unicode some how? And what is the best way to do that? Also, will this cause any problems when loading and saveing? Also, will it cause any problems in Javascript?

http://en.wikipedia.org/wiki/Greek_language

Α α Alpha Β β Beta
Γ γ Gamma Δ δ Delta
Ε ε Epsilon Ζ ζ Zeta
Η η Eta Θ θ Theta
Ι ι Iota Κ κ Kappa
Λ λ Lambda Μ μ Mu
Ν ν Nu Ξ ξ Xi
Ο ο Omicron Π π Pi
Ρ ρ Rho Σ σ ς Sigma
Τ τ Tau Υ υ Upsilon
Φ φ Phi Χ χ Chi
Ψ ψ Psi Ω ω Omega

DougT
04-02-2006, 11:29 PM
Hi,

You could use the Symbol Font for the textbox

Regards
Doug

rex64
04-03-2006, 08:26 AM
Will the symbol font support all unicode languages?
I would like it to support English, Spanish, Chineese, Greek, Hebrew...

surixurient
04-11-2006, 10:23 AM
use forms 2.0 form controls

normaly vb uses all the createwindowexA, defwindowprocA etc instead of the W ones. and turns everything to ansi. but forms 2.0 has unicode form controls

rex64
04-11-2006, 09:23 PM
Does that include a special runtime DLL?

surixurient
04-12-2006, 03:26 PM
FM20.DLL
comes with vb6

rex64
04-12-2006, 04:25 PM
Is that file compatiable with Win95, Win98, and is it compatiable with Win 3.1?
FM20.DLL
comes with vb6

rex64
04-12-2006, 05:02 PM
Is there a custom control that does not require a DLL available? I noticed this file is over a megabyte. That seems very large for a rectangle and a little text :)

surixurient
04-13-2006, 07:52 AM
i really dont know. but you can subclass a normal textbox to make it support unicode. (*atempts*)

surixurient
04-13-2006, 08:19 AM
subclassing a normal vb textbox to support unicode was a pain, so just create a standard windows editbox



you will have to change your api definitions

an example


Public Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExW" (ByVal dwExStyle As Long, ByVal lpClassName As Long, _
ByVal lpWindowName As Long, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, _
ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long

notice the W instead of A and you are sending strings as a long (pointer to the address of the unicode string). use byval strptr(astring) to send them. so vb doesnt convert it to ansi

an example to create a unicode editbox (textbox)

MyTextBoxhWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, ByVal StrPtr("EDIT"), _
ByVal StrPtr(""), WS_VISIBLE Or WS_CHILD Or ES_AUTOHSCROLL Or ES_NOHIDESEL, _
10, 10, 150, 25, frmMain.hWnd, 0, App.hInstance, ByVal 0&)

then if you set its window proc to have control of it, make sure you are using all W versions of the api functions, and passing the strings correctly

rex64
04-13-2006, 09:13 AM
Awesome.

I put your code in, however it says 'object required'. I think it needs the definitions of WS_VISIBLE...


Dim myTextBoxhWnd
myTextBoxhWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, ByVal StrPtr("EDIT"), ByVal StrPtr(""), WS_VISIBLE Or WS_CHILD Or ES_AUTOHSCROLL Or ES_NOHIDESEL, _
10, 10, 150, 25, frmMain.hWnd, 0, App.hInstance, ByVal 0&)


Also, does this work on Win95, Win98 and does it work on Win 3.1?

surixurient
04-13-2006, 09:17 AM
they should just be the standard declarations in API viewer
(you need to have frmMain already be loaded into memory as well)

Option Explicit

Public Const WS_VISIBLE = &H10000000
Public Const WS_CHILD = &H40000000
Public Const ES_AUTOHSCROLL = &H80&
Public Const ES_NOHIDESEL = &H100&
Public Const WS_OVERLAPPED = &H0&
Public Const WS_CAPTION = &HC00000
Public Const WS_SYSMENU = &H80000
Public Const WS_THICKFRAME = &H40000
Public Const WS_MINIMIZEBOX = &H20000
Public Const WS_MAXIMIZEBOX = &H10000

'Public Const WS_EX_OVERLAPPEDWINDOW = (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)
Public Const WS_EX_OVERLAPPEDWINDOW = &H300
Public Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExW" (ByVal dwExStyle As Long, ByVal lpClassName As Long, _
ByVal lpWindowName As Long, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, _
ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextW" (ByVal hwnd As Long, ByVal lpString As Long) As Long


Public edithWnd As Long

Public Sub Main()
Dim frm As Form1
Set frm = New Form1
frm.Show
edithWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, ByVal StrPtr("EDIT"), ByVal StrPtr(""), WS_VISIBLE Or WS_CHILD Or ES_AUTOHSCROLL Or ES_NOHIDESEL, _
10, 10, 150, 25, frm.hwnd, 0, App.hInstance, ByVal 0&)
SetWindowText edithWnd, ByVal StrPtr("AHAHAHA")
Set frm = Nothing

End Sub

rex64
04-13-2006, 09:24 AM
Excellent. It is working.

I need a scrool bar on the right. Also, I need the background color to be &H00EAEAEA&

And how do turn on multiline.

Thanks!

surixurient
04-13-2006, 10:22 AM
add these to dwstyle
Public Const WS_VSCROLL = &H200000
Public Const ES_MULTILINE = &H4&

as for background color..im not sure;P

try some experimenting

surixurient
04-13-2006, 10:36 AM
i read, when as edit control needs to be drawn it sends the WM_CTLCOLOREDIT to its parent, the parent then returns a handle to a brush when it processes this message, and the system uses that brush to paint the controls background.

so youd have to have a windowproc for your main form

when it receives the message WM_CTLCOLOREDIT from your editcontrol, it should return a handle to a brush of the color you want you edit control
windows wont delete this brush so youll have to delete it yourself when the form unloads

rex64
04-15-2006, 02:33 PM
I am not sure what I need to do. Can you explain a little more, and maybe give a little example?

Is this related?
http://www.vb-helper.com/howto_allow_only_digits.html

surixurient
04-17-2006, 08:43 AM
yeah thats related in that it sets a window's windowproc.

youd have to set your main window's windowproc, then in it test for the WM_CTLCOLOREDIT message.


Public Sub Hook(hwnd As Long)
Dim lb As LOGBRUSH
lb.lbColor = 220
lb.lbStyle = 0
lb.lbHatch = 0

ebColor = CreateBrushIndirect(lb)'brush with new background color of editbox
OldWindowProc = SetWindowLong( _
hwnd, GWL_WNDPROC, _
AddressOf NewWindowProc)
End Sub
Public Sub UnHook(hwnd As Long)
SetWindowLong hwnd, GWL_WNDPROC, OldWindowProc
DeleteObject ebColor'delete brush
End Sub
Public Function NewWindowProc(ByVal hwnd As Long, ByVal Msg _
As Long, ByVal wParam As Long, ByVal lParam As Long) As _
Long
If (Msg = WM_CTLCOLOREDIT) And (lParam = edithWnd) Then 'lParam is hWnd of control wParam is hDC of control
CallWindowProc OldWindowProc, hwnd, Msg, wParam, lParam'let windows do what it normal does
SetBkColor wParam, 220 'set bkcolor for text
NewWindowProc = ebColor 'return brush with the background color you want windows to use when redrawing
Else
NewWindowProc = CallWindowProc( _
OldWindowProc, hwnd, Msg, wParam, _
lParam)
End If
End Function


also, yo uwant windows to redraw it with this color right from the start, so as soon as you craete the editcontrol, use the function InvalidateRect with its width and height, to redraw it right away

rex64
05-15-2006, 09:50 AM
I know I am mixing threads, but is there an easy way to tell it to just not draw the background on an edit box?
http://www.xtremevbtalk.com/showthread.php?t=259721

Also, this is all the code I could come up with. Sorry, I am not very good at this complicated stuff.

NewWindowProc Me, 0, 0, 0

rex64
05-23-2006, 04:35 PM
*bump*

I need help with the last message. Thanks.

rex64
06-04-2006, 06:03 PM
*bump*

rex64
06-04-2006, 07:51 PM
So far, here is the code I have. It runs, but nothing happens.

Also, once I create the edit box, how do I change the text inside it? A quick example would be great. All this API stuff is hard, but I think I am starting to understand some of this stuff.

Also, is there a way to give my edit control a name where it can be accessed just like the old text box?

Public Sub Hook(hwnd As Long)
Dim lb As LOGBRUSH
lb.lbColor = 220
lb.lbStyle = 0
lb.lbHatch = 0

ebColor = CreateBrushIndirect(lb)'brush with new background color of editbox
OldWindowProc = SetWindowLong( _
hwnd, GWL_WNDPROC, _
AddressOf NewWindowProc)
End Sub
Public Sub UnHook(hwnd As Long)
SetWindowLong hwnd, GWL_WNDPROC, OldWindowProc
DeleteObject ebColor'delete brush
End Sub
Public Function NewWindowProc(ByVal hwnd As Long, ByVal Msg _
As Long, ByVal wParam As Long, ByVal lParam As Long) As _
Long
If (Msg = WM_CTLCOLOREDIT) And (lParam = edithWnd) Then 'lParam is hWnd of control wParam is hDC of control
CallWindowProc OldWindowProc, hwnd, Msg, wParam, lParam'let windows do what it normal does
SetBkColor wParam, 220 'set bkcolor for text
NewWindowProc = ebColor 'return brush with the background color you want windows to use when redrawing
Else
NewWindowProc = CallWindowProc( _
OldWindowProc, hwnd, Msg, wParam, _
lParam)
End If
End Function
Private Sub Form_Load()
Dim myTextBoxhWnd As Long
myTextBoxhWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, ByVal StrPtr("EDIT"), ByVal StrPtr(""), _
WS_VISIBLE Or WS_CHILD Or ES_AUTOHSCROLL Or ES_NOHIDESEL Or WS_VSCROLL Or ES_MULTILINE, _
10, 10, 400, 75, frmStudy.hWnd, 0, App.hInstance, ByVal 0&

NewWindowProc hWnd, myTextBoxhWnd, myTextBoxhWnd, myTextBoxhWnd
end sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Declare Function SetBkColor Lib "GDI32" (ByVal hDC As Long, ByVal crColor As Long) As Long

Declare Function SetBkMode Lib "GDI32" _
(ByVal hDC As Long, ByVal nBkMode As Long) As Long

rex64
06-09-2006, 02:55 PM
*bump*

Richard87
06-09-2006, 03:03 PM
if you are using a new system, you could use Alpha Blending it white... ;)

check out
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

with wich you could set the text boks not to paint any white stuff...

surixurient
06-09-2006, 03:59 PM
ive attached a sample

rex64
06-09-2006, 04:33 PM
SWEET! I think that answers pretty much all of my major questions about the edit box. One other question, unicode ListBox. What do you recommend?
ive attached a sample

rex64
06-09-2006, 06:43 PM
One more problem. Why does it keep telling me, invalid use of AddressOf operator?

OldWindowProc = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf NewWindowProc)

DougT
06-09-2006, 10:51 PM
Hi,

You have kept NewWindowProc in a module (.bas) haven't you ? For reasons that I don't know about AddressOf can only resolve addresses of routines that are in a .bas file.

Regards
Doug

rex64
06-13-2006, 09:16 PM
Great. I am past that now. Thanks.
You have kept NewWindowProc in a module (.bas) haven't you ?

Now I am having trouble figureing out what I am doing wrong.

Public Sub Main()
Dim frm As frmStudy
Dim hDC As Long
Set frm = New frmStudy
frm.Show

Dim edithWnd As Long
Dim hDC As Long
edithWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, ByVal StrPtr("EDIT"), _
ByVal StrPtr(""), WS_VSCROLL Or WS_VISIBLE Or WS_CHILD Or ES_AUTOHSCROLL Or _
ES_NOHIDESEL Or ES_MULTILINE, 10, 10, 150, 150, frm.hWnd, 0, App.hInstance, ByVal 0&)
'edithWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, ByVal StrPtr("EDIT"), ByVal StrPtr(""), _
WS_VISIBLE Or WS_CHILD Or ES_AUTOHSCROLL Or ES_NOHIDESEL Or WS_VSCROLL Or ES_MULTILINE, _
140, 65, 390, 75, frm.hWnd, 0, App.hInstance, ByVal 0&)
hDC = GetDC(edithWnd)
SetBkColor hDC, 13
SendMessage edithWnd, WM_CTLCOLOREDIT, ByVal 0&, ByVal 0&
ReleaseDC edithWnd, hDC
SetWindowText edithWnd, ByVal StrPtr("AHAHAHA")

Set frm = Nothing
End Sub
Private Sub Form_Load()
Hook Me.hWnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnHook Me.hWnd
End Sub

DougT
06-13-2006, 11:03 PM
And the behaviour of this code is ......? (ie What are the symptoms?)

rex64
06-14-2006, 10:07 AM
Sorry. I am having trouble with it not being the correct size, and also the color is not changeing. Any ideas?
And the behaviour of this code is ......? (ie What are the symptoms?)

darkforcesjedi
06-14-2006, 11:07 AM
The MoveWindow API can be used to MOVE, RESIZE, and force the control to REPAINT.

rex64
06-14-2006, 11:38 AM
What is the function for getting text? Also, I got everything working, except the text color remains gery instead of red. Why would this be?

Also, does this look right:
MoveWindow hDC, 100, 100, 200, 200, 1


Private Sub Form_Load()
Hook Me.hwnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnHook Me.hwnd
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''
Public Sub Main()
Dim frm As frmStudy
Dim hDC As Long
Set frm = New frmStudy
frm.Show

Dim edithWnd As Long

edithWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, ByVal StrPtr("EDIT"), _
ByVal StrPtr(""), WS_VSCROLL Or WS_VISIBLE Or WS_CHILD Or ES_AUTOHSCROLL Or _
ES_NOHIDESEL Or ES_MULTILINE, 140, 65, 390, 75, frm.hwnd, 0, App.hInstance, ByVal 0&)
'edithWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, ByVal StrPtr("EDIT"), ByVal StrPtr(""), _
WS_VISIBLE Or WS_CHILD Or ES_AUTOHSCROLL Or ES_NOHIDESEL Or WS_VSCROLL Or ES_MULTILINE, _
140, 65, 390, 75, frm.hWnd, 0, App.hInstance, ByVal 0&)
hDC = GetDC(edithWnd)
SetBkColor hDC, 13
SendMessage edithWnd, WM_CTLCOLOREDIT, ByVal 0&, ByVal 0&
ReleaseDC edithWnd, hDC
SetWindowText edithWnd, ByVal StrPtr("AHAHAHA")
MoveWindow hDC, 100, 100, 200, 200, 1
Set frm = Nothing
End Sub
Public Sub Hook(hwnd As Long)

Dim lb As LOGBRUSH
lb.lbColor = 220
lb.lbStyle = 0
lb.lbHatch = 0

ebColor = CreateBrushIndirect(lb) 'brush with new background color of editbox
OldWindowProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf NewWindowProc)
End Sub
Public Sub UnHook(hwnd As Long)
SetWindowLong hwnd, GWL_WNDPROC, OldWindowProc
DeleteObject ebColor 'delete brush
End Sub

Public Function NewWindowProc(ByVal hwnd As Long, ByVal Msg _
As Long, ByVal wParam As Long, ByVal lParam As Long) As _
Long
If (Msg = WM_CTLCOLOREDIT) And (lParam = edithWnd) Then 'lParam is hWnd of control wParam is hDC of control
CallWindowProc OldWindowProc, hwnd, Msg, wParam, lParam 'let windows do what it normal does
SetBkColor wParam, 220 'set bkcolor for text
NewWindowProc = ebColor 'return brush with the background color you want windows to use when redrawing
Else
NewWindowProc = CallWindowProc( _
OldWindowProc, hwnd, Msg, wParam, _
lParam)
End If
End Function


Edit:
I got it working. All I needed was to declare the variable as public. I got getWindowText working too. Thanks.
Dim edithWnd As Long

rex64
06-14-2006, 01:37 PM
Something strange is happening. My messagebox is not displaying the string very well. It is not displaying the text.

I tried getting the error message. The size of the GetWindowTextLengh keeps coming out as 0.

Dim MyStr As String
'Create a buffer
MyStr = String(GetWindowTextLength(edithWnd) + 1, Chr$(0))
'Get the window's text
GetWindowText edithWnd, MyStr, Len(MyStr) 'edithWnd
txtQuestion3 = "Begin:" & MyStr & ":End" & vbCrLf & ":line2:"
'txtQuestion3 = edithWnd
MsgBox GetWindowTextLength(edithWnd)

Dim Buffer As String
'Create a string buffer
Buffer = Space(200)
'Set the error number
'SetLastError ERROR_BAD_USERNAME
'Format the message string
FormatMessage FORMAT_MESSAGE_FROM_SYSTEM, ByVal 0&, GetLastError, _
LANG_NEUTRAL, Buffer, 200, ByVal 0&
'Show the message
MsgBox Buffer
'txtQuestion3 = Buffer


All it displays is "Begin:" and that is it.

rex64
06-15-2006, 10:44 AM
Something I am doing with the Edit Box must be wrong. It is not getting the text. Please see the project. Thanks.

surixurient
06-16-2006, 08:49 AM
put "option explicit" on the form

it will tell you edithWnd is not declared.

it is private in the module

rex64
06-18-2006, 08:33 PM
On my edit box. I have noticed that you have to press Shift Enter sometimes. Also, I have noticed that when you press tab it puts a tab in instead of going to the next control. Also, I have noticed that it is not in the tab order. Thanks.

rex64
07-15-2006, 03:59 PM
*bump*

darkforcesjedi
07-18-2006, 05:17 AM
Have the form KeyPreview and when the tab key is pushed down, shift focus appropriately and then clear the keycode. The tab key inserts a tab in your new control because you don't process that message in your window proc. Instead you're passing it right on the the OldWindowProc. As far as the edit box is concerned a tab key means add a tab character. Use SetFocus to focus your controls. Store all of their hWnds in an array and move through the array to get to the right controls:

Private Declare Function SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long

rex64
07-18-2006, 10:27 AM
Thanks. That looks great so far.

One question I had was, where should I release the hWnd, or do I even have to do it? Or what does this actually do?

ReleaseDC questionhWnd, questionhDC


Also, I tried setting the keyPreview to true. However, it would still not work. I think because I have main set as the startup object instead of the form. But I need main to be first. Let me know what I should do. I tried KeyPress also. This code is not even being executed.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'If KeyCode = vbKeyRight Then
' rightButton_Click
'End If
SetFocus answerhWnd
End Sub

darkforcesjedi
07-18-2006, 02:35 PM
You should have an array of hWnds for your controls.
Dim vTabOrder As Variant
Dim lTabPos as Long

Private Sub Form_Load()
vTabOrder = Array(Control1.hWnd,Control2.hWnd,...)
SetFocus vTabOrder(lTabPos)
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then
If Shift And 1 Then ' Shift+Tab to go backwards
lTabPos = (lTabPos + UBound(vTabOrder)) Mod (UBound(vTabOrder) + 1)
Else
lTabPos = (lTabPos + 1) Mod (UBound(vTabOrder) + 1)
End If

SetFocus vTabOrder(lTabPos)
KeyCode = 0
Shift = 0
End If
End Sub

rex64
07-18-2006, 02:59 PM
This is only working when the focus is on the Form. However if you are clicked in the Edit box then it does not work. Any ideas what I need to do?

Also, you may see my attempt with the attached project. I got the focus to work before, but with this implementation, I am not sure what I need to do. Thanks again.

darkforcesjedi
07-19-2006, 07:41 AM
There are a few problems with your code. I also think there may be a problem with the extended window style you apply to the Edit control. While SetFocus will move the cursor to the edit window, it never actually gets the focus (the last control keeps the focus -- press the enter key in the edit control to see what I mean). Also, the edit window doesn't seem to be receiving keyboard messages (I printed all the messages to the debug window in the window proc, but WM_KEYDOWN never showed up.) This may have something to do with the fact that the control (while you can type in it) never actually has the keyboard focus.

1. edithWnd is declared local to Module1 and therefore is invisible to Form1. Use Public instead of Dim
2. You try to call SetFocus without declaring it (see my previous post with the declare for setfocus)
3. SetFocus is a method of Form objects, so you need to change the "Declare SetFocus" to "Declare ShiftFocus" or something else (renaming it will require Alias "SetFocus" in the declare statement) if you want to call it directly, or declare it public in a module and call it using MODULENAME.SetFocus


I had the tab order stuff working among everything EXCEPT the edit window last night, but I gave up when I found out that the WM_KEYDOWN message wasn't finding its way to your window proc.

I don't know much about creating windows via API, but I would assume the inability to receive focus has something to do with the way you created the window.

darkforcesjedi
07-19-2006, 07:50 AM
Is there a reason you can't use a Forms 2.0 textbox?

darkforcesjedi
07-19-2006, 07:56 AM
Try using the WS_TABSTOP window style! Here are the styles of an Edit window in another aplication that works ok.

Styles:
WS_CHILD
WS_VISIBLE
WS_TABSTOP
ES_LEFT
ES_MULTILINE
ES_AUTOHSCROLL
ES_WANTRETURN

StylesEx:
WS_EX_NOPARENTNOTIFY
WS_EX_CLIENTEDGE
WS_EX_LEFT
WS_EX_LTRREADING
WS_EX_RIGHTSCROLLBAR

rex64
07-28-2006, 09:45 AM
Thanks. That makes it behave a little better. But either I did something wrong, or maybe this is still not quite the perfect solution. I would like to have 2 edit boxes and a button. And I would like the tab order to go from the first edit box, to the second and then to the button. This is the test program, and the edit box still does not seem to accept focus. I fixed all the things you talked about. You can double check my constants, by the way. I pulled them all from Google, so it is possible there is an invalid one in there.

rex64
08-03-2006, 10:10 AM
*bump*

rex64
08-13-2006, 06:22 PM
*bump*

rex64
08-26-2006, 01:14 PM
Please help me with this if you can. Or let me know good resources such as books and such that would help. Thanks.

rex64
09-01-2006, 12:11 PM
*bump*

Please, there must be someone who knows how to grab Text before my edit box steals it? I will manually write the tab order control if I need to. Let me know any good resources. I just can not find anything on Google and I do not know any good books.

rex64
09-19-2006, 07:36 AM
Who should I contact? Microsoft? Or is there a good API book that would help, or an author I could contact? Thanks.

rex64
09-23-2006, 11:31 AM
Ok, I have a good idea. This thread made me think of it, although I think they are doing something different. http://www.vbforums.com/showthread.php?t=425613

My idea is to create a custom control that has an edit box in it. I do not know much about custom controls, but would this help with the tab focus? Let me know what you think. Thanks.

rex64
10-03-2006, 10:52 AM
Come on, just a little help. Give it one last shot. We are SOOOOO close. Just need to fix the tab thing and it should be ok.

I would like to get it working, or try the custom control thing. I do not know how I will do the events and stuff. I am worried that this will not work.
http://pages.cpsc.ucalgary.ca/~saul/vb_examples/tutorial8/xparant.html

cenit33
10-03-2006, 12:55 PM
There are lots of posts in this thread and I have not read all. Is the problem that the edit window with style WS_TABSTOP not will be focused with tabkey.

If so the problem is lying in the messageloop. I don't know how to get access to the messageloop. The principle for the messageloop is

GetMessage, TranslateMessage and DispatchMessage that i uMsg if you subclass a window.

If you create a window with CreateWindowEx and WS_TABSTOP you must also check for keybord messages with IsDialogMessage. The messageloop will be like this

GetMessage, IsDialogMessage, TranslateMessage and DispatchMessage

How this is solved with VBcontrols, I don't know. I don't think you can get taborder work with the edit window, unless you know a way to get into the messageloop.

cenit33
10-03-2006, 01:05 PM
You can try to subclass the window and check all message with IsDialogMessage. If the function i true (or false I don't remeber) exit the windowprocess with value 0 and don't let the message go through.

rex64
10-03-2006, 02:02 PM
Post 45 is the my most updated test version. Your method looks cool, but I will have to research that a while to figure out how I will do that. Would that work inside a custom control? That way it will all be packaged together?

Also, is there a way I can just add a keyPress event to the Edit box? That way I can handle it manually.

cenit33
10-03-2006, 02:46 PM
Also, is there a way I can just add a keyPress event to the Edit box? That way I can handle it manually.


Yes, you can subclass the edit window to access edit window process.

rex64
10-03-2006, 02:53 PM
Can you give me a few pointers or examples on how to do this? Thanks.
Yes, you can subclass the edit window to access edit window process.

cenit33
10-03-2006, 03:18 PM
OldEditProc = SetWindowLong(edithWnd, GWL_WNDPROC, AddressOf EditProc)

Public Function EditProc(ByVal hwnd As Long, ByVal MSG As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

If MSG = WM_ERASEBKGND Then
Exit Function
End If
EditProc = CallWindowProc(OldEditProc, hwnd, MSG, wParam, lParam)

End Function

rex64
10-04-2006, 05:33 PM
I am already doing something similar. Please see my most recent ZIP file. How would I detect keystrokes? I guess it would be a type of msg. What is a good resource for a list of messages and do you know a good one to detect keystrokes?

Also, every time you make a mistake it seems like it crashes the IDE and program. Do you know what is wrong?
[code]
Public Function EditProc...

rex64
10-04-2006, 08:43 PM
I can detect when a key is pressed because a 307 MSG appears, but how do I figure out what key was pressed? Im guessing there is an API for that, but I do not know what it would be. Hmmmm.

rex64
10-16-2006, 05:39 PM
Any ideas?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum