PDA

Click to See Complete Forum and Search --> : Cursor


Kars Lensen
Dec 16th, 1999, 01:52 AM
I put this code in a program for having a bigger cursor for EVERY textbox:

Private Sub txtOrdArtikelnr_GotFocus()
h& = GetFocus&(): sb& = Picture1.Picture: Call CreateCaret(h&, sb&, 1, 5): sx& = ShowCaret&(h&)
End Sub
Private Sub txtOrdArtikelOms_GotFocus()
h& = GetFocus&(): sb& = Picture1.Picture: Call CreateCaret(h&, sb&, 1, 5): sx& = ShowCaret&(h&)
End Sub
Private Sub txtOrdaantal_GotFocus()
h& = GetFocus&(): sb& = Picture1.Picture: Call CreateCaret(h&, sb&, 1, 5): sx& = ShowCaret&(h&)
End Sub
Private Sub txtOrdEenheid_GotFocus()
h& = GetFocus&(): sb& = Picture1.Picture: Call CreateCaret(h&, sb&, 1, 5): sx& = ShowCaret&(h&)
End Sub
Private Sub txtOrdPrijs_GotFocus()
h& = GetFocus&(): sb& = Picture1.Picture: Call CreateCaret(h&, sb&, 1, 5): sx& = ShowCaret&(h&)
End Sub

And several more of these sub's. I think this can be done better and easy'er. Any one have suggestions ?


------------------

Aaron Young
Dec 16th, 1999, 01:56 AM
Create a Textbox Control Array, then you can use the Same piece of code for all the Textboxes.

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

jpark
Dec 16th, 1999, 02:06 AM
It would much easier if u created those textboxes as control array in first place.
Just place the code in one sub
Private Sub txtOrder_GotFocus(Index as Integer)
h& = GetFocus&(): sb& = Picture1.Picture: Call CreateCaret(h&, sb&, 1, 5): sx& = ShowCaret&(h&)
End Sub

Make it sub and call it, not much but u can reduce some code their :)

Delcare as public in module if diffrent forms call it

private sub BigCursor()

h& = GetFocus&(): sb& = Picture1.Picture: Call CreateCaret(h&, sb&, 1, 5): sx& = ShowCaret&(h&)

end sub

Joon

[This message has been edited by jpark (edited 12-16-1999).]

Kars Lensen
Dec 16th, 1999, 02:34 AM
Thanks Aaron and Joon for the fast reply. This will work but I still have to make a sub for every textbox in the program for calling the BIGCURSOR. What I was thinking was: When in the whole program a textbox got the focus (GotFocus) the cursor become's big.
(maybe you can give me an example off a textbox control array ?, I am not quit understanding what this means)

------------------

jpark
Dec 16th, 1999, 04:01 AM
Why do u have to make the sub for every textbox? Make one and call it for each textbox's GotFocus event.

Textbox control array example

On the Form, draw a TextBox, and name it.
(In this example, I called it "txtOrder")

Copy the textbox and paste it as many as u need.
(When first one is pasted, the massagebox will ask u to create control array.)

Put the code to change a big picture in the GotFous events of txtOrder textbox control array.

Private Sub txtOrder_GotFocus(Index as Integer)
h& = GetFocus&(): sb& = Picture1.Picture: Call CreateCaret(h&, sb&, 1, 5): sx& = ShowCaret&(h&)
End Sub

Joon