Solved

Marquee to select multiple control at Run Time

Posted on 2002-07-09
6
150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

749 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