I'm drawing lines on the screen based on coords. from a database, embedded in the code, I would like to automatically select those lines, maybe by their handles. I can't seem to find any examples to do this. Can you tell me the command to select an entity based on it's handle in VB6.
Thanks
Page 1 of 1
Select a previously drawn entity would like to select an entity previously drawn in a coded routine
#2
Posted 10 August 2009 - 08:20 AM
Here it is an example on how to select lines from their database id:
Private Sub Form_Load()
Dim h() As Long, DatabaseID As String
Dim Handles() As Long, DatabaseIDToSelect As String
Call cAvax1.StartAvax
ReDim h(2) As Long
h(1) = cAvax1.Add_Line(0, 0, 0, 10, 10, 0)
DatabaseID = "1"
Call cAvax1.SetHandleKey(h(1), DatabaseID)
h(2) = cAvax1.Add_Line(15, 0, 0, 15, 10, 0)
DatabaseID = "2"
Call cAvax1.SetHandleKey(h(2), DatabaseID)
DatabaseIDToSelect = "1"
If cAvax1.GetHandlesByKey(DatabaseIDToSelect, Handles()) <> 0 Then
Call cAvax1.SelectItems(Handles())
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call cAvax1.EndAvax
End Sub
Athanasios Gardos
Avax-Software.com
Avax-Software.com
#5
Posted 31 August 2009 - 10:53 AM
Have a look at this example and if you have any question please let me know.
Private Sub Form_Load()
Dim h() As Long, DatabaseID As String
Dim Handles() As Long, DatabaseIDToSelect As String
Call cAvax1.StartAvax
ReDim h(2) As Long
h(1) = cAvax1.Add_Line(0, 0, 0, 10, 10, 0)
DatabaseID = "1"
Call cAvax1.SetHandleKey(h(1), DatabaseID)
h(2) = cAvax1.Add_Line(15, 0, 0, 15, 10, 0)
DatabaseID = "2"
Call cAvax1.SetHandleKey(h(2), DatabaseID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call cAvax1.EndAvax
End Sub
Private Sub Command1_Click()
Dim lHandles() As Long
Dim i As Long
Dim RotX As Single, RotY As Single, Theta As Single
RotX = 3.2
RotY = 2
Theta = 30
If cAvax1.GetAllHandlesArr(lHandles()) <> 0 Then
Call cAvax1.SelectItems(lHandles())
Call cAvax1.RotateItems(lHandles(), RotX, RotY, Theta)
End If
End Sub
#6
Posted 02 September 2009 - 01:40 AM
hermes, on 31 August 2009 - 05:53 AM, said:
Have a look at this example and if you have any question please let me know.
Private Sub Form_Load()
Dim h() As Long, DatabaseID As String
Dim Handles() As Long, DatabaseIDToSelect As String
Call cAvax1.StartAvax
ReDim h(2) As Long
h(1) = cAvax1.Add_Line(0, 0, 0, 10, 10, 0)
DatabaseID = "1"
Call cAvax1.SetHandleKey(h(1), DatabaseID)
h(2) = cAvax1.Add_Line(15, 0, 0, 15, 10, 0)
DatabaseID = "2"
Call cAvax1.SetHandleKey(h(2), DatabaseID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call cAvax1.EndAvax
End Sub
Private Sub Command1_Click()
Dim lHandles() As Long
Dim i As Long
Dim RotX As Single, RotY As Single, Theta As Single
RotX = 3.2
RotY = 2
Theta = 30
If cAvax1.GetAllHandlesArr(lHandles()) <> 0 Then
Call cAvax1.SelectItems(lHandles())
Call cAvax1.RotateItems(lHandles(), RotX, RotY, Theta)
End If
End SubHermes,
Thanks for the example. I had already found RotateItem andfigured that was the direction I needed to go, you confirmed that forme. I would like to be able to determine to rotation angle on thescreen with the mouse, is that possible?
Thank You,
Tim
Page 1 of 1
Sign In
Register
Help
Add Reply

MultiQuote