Click to See Complete Forum and Search --> : have no idea how to


Tarendor
September 15th, 2001, 11:42 AM
Ok i want to find a way to take the text out of the text boxes and use them

here is the way i get the text info
i creat a form and have 2 text boxes on it and 2 command buttons on it also.
button one = cmdTargetDeed
button two = cmdSetPlaceTarget
text1 box = txtDeedX
text2 box = txtDeedy
text3 box = txtHousePlaceX
text4 box = txtHousePlacey
so i have 2 command buttons and 4 text feilds

In the form:

private Sub Form_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)
'get the current cursor position
GetCursorPos Pt
me.CurrentX = 0
me.CurrentY = 0
'Clear the screen
' me.Cls
' me.print "Cursor position:"
'print the mouse coördinates to the form
If bDeed = true then
txtDeedX.Text = Str$(Pt.X)
txtDeedY.Text = Str$(Pt.Y)
ElseIf bPlaceSpot = true then
txtHousePlaceX.Text = Str$(Pt.X)
txtHousePlaceY.Text = Str$(Pt.Y)
End If

'Release mouse to other windows
ReleaseCapture
End Sub




in the module:

option Explicit
private Type POINTAPI
X as Long
Y as Long
End Type

public Declare Function SetCapture Lib "user32" (byval hwnd as Long) as Long
public Declare Function ReleaseCapture Lib "user32" () as Long
public Declare Function GetCursorPos Lib "user32" (lpPoint as POINTAPI) as Long
public Pt as POINTAPI




in the cammand1 button (cmdTargetDagger):


private Sub cmdTargetDagger_Click()
'caption mouse so other windows won't get clicks
bDagger = true
bSelf = false
SetCapture (me.hwnd)
End Sub





in the cammand2 button (cmdTargetSelf):


private Sub cmdTargetSelf_Click()
'caption mouse so other windows won't get clicks
bSelf = true
bDagger = false
SetCapture (me.hwnd)
End Sub





so now wheh i hit one of the buttons and click on the desk top it puts the exact mouse coords based on x and y of the screen into the correct text feilds that they belong with, but now i want to be able to use the info that was put into the text feilds in another command, so after i get the info with the code above it can be added into the command that fires off the mouse clicks.

but i want the info to be added into the code that fires the mouse click for me each time.(but only when i hit the command button.)

example:

MouseDown = txtHousePlaceX.Text = Str$(Pt.X)
MouseDown = txtHousePlacey.Text = Str$(Pt.y)

or something like that but the x and y value are set by the info that was generated in the text feilds from the code above and reset each time the x and y are set.

does this make sence?