Solved

Marquee to select multiple control at Run Time

Posted on 2002-07-09
6
149 Views
Last Modified: 2010-05-02
 I am writing an application that allow user to place vb control into form at Run Time. I am able to draw a marquee by using a shape.

  My problem is :
1. how to select the objects within the marquee that I have drawn

This is just like what we always did at design time when we select multiple control and move it but I want it to be done during the Run Time.

Please guide me.

Sweetpillow.
0
Comment
Question by:sweetpillow
6 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 7142947
Here is an example (not very clever) that checks whether the controls on the form are within the bounding rectangle of the shape control.

Private shpMarquee As Shape

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If (shpMarquee Is Nothing) Then
        Set shpMarquee = Me.Controls.Add("VB.Shape", "shpMarquee")
        With shpMarquee
            .Visible = True
            .Top = X
            .Left = X
        End With
    Else
       
    End If
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If shpMarquee Is Nothing Then Exit Sub
    On Error Resume Next
    If Button > 1 Then
        List1.Clear
        Dim ctrlToCheck As Control
        For Each ctrlToCheck In Me.Controls
            If ctrlToCheck.Left > shpMarquee.Left And ctrlToCheck.Width + ctrlToCheck.Left < shpMarquee.Left + shpMarquee.Width And ctrlToCheck.Top > shpMarquee.Top And ctrlToCheck.Top + ctrlToCheck.Height < shpMarquee.Top + shpMarquee.Height Then
                List1.AddItem ctrlToCheck.Name
            End If
        Next
    ElseIf Button = 1 Then
        With shpMarquee
            .Width = X - .Left
            .Height = Y - .Top
        End With
    End If
End Sub
0
 

Author Comment

by:sweetpillow
ID: 7144975
Hi TimCottee,

  How to do like vb design time when we draw a marquee the objects within marquee will be selected and the marquee will be hidden but all the selected objects will have 8 handles ?
  Then when we click on any of the selected objects, we can move all objects at one time. I wonder if there is any windows function doing this job...

Sweetpillow.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8002254
Hi sweetpillow,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept TimCottee's comment(s) as an answer.

sweetpillow, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:sweetpillow
ID: 8005385
Hi Dan,

       The comment from Tim really do not exactly stimulate what I want to do. Thats why I do not accept his comment as answer. My last comment is not answered anyway. But nevermind, I have found a solution by myself by using another picture mouse down, mouse move and mouse up to stimulate the real box when user is dragging the mouse. Thanks.

Note: By the way, I would like to know how to delete a question when I no longer wanted it ?

Sweetpillow.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8005451
In the future, you can post a 0-pt question to the Community Support Topia Area.  Be sure to identify the question by its Q# or the full URL.

For this question, you do not need to do anything because it is already in the cleanup queue.  I think that Tim Cottee's comments are worth preserving so...
Moderator,  I am changing my recommendation to:

   Refund and save as 0-pt PAQ
==========
DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8095154
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question