realbasic-nug
[Top] [All Lists]

Re: need a jump start: mouse drag question

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: need a jump start: mouse drag question
From: Charles Yeomans <yeomans at desuetude dot com>
Date: Mon, 17 Jan 2005 09:42:25 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20050116180036 dot 2F97B6905DD at lists dot realsoftware dot com> <AD234D67-6820-11D9-A7A0-000A279192DE at alienapparatus dot com> <p06200709be1100e0f793 at [192 dot 168 dot 1 dot 44]>

On Jan 17, 2005, at 12:49 AM, Marc Antony Vose wrote:

Hi there:

I've prototyped a simple application in Flash, which I have more experience with. This is one of my first attempts to do something with REALbasic, so I'm not the most experienced with its 'paradigm'.

I'm hoping someone can just give me a strategic jumpstart here.

I need to draw some rectangles with text inside them to the screen, and allow the user to drag them around and arrange them how they want.

Simple enough.

It seems you can't subclass a control, and then instantiate it with code. Is this true? (I tried subclassing the 'Placard' class, which would seem to be sort of what I want, except that I have no way of knowing how many placards will need to be displayed. The IDE complains that I can't "dynamically create controls from classes")

OK, so can I just either draw a vector shape, or a normal graphics shape, and then assign it mouse events (i.e., make it respond to MouseDown and MouseDrag)?

Or, should I be doing this inside a "SpriteSurface", with sprites? Thing is, I'm not sure exactly how a SpriteSurface responds to mouse events.

I'll figure out the ins and outs of the code myself looking at the docs and examples; I just need a jumpstart in the right strategic direction. How would you go about accomplishing this?


You can create new instances of controls at runtime by cloning existing controls. Take a look in the Rb User Guide for "control array". In short, you place a control in a window in the IDE, then set its Index property in the Properties browser to a value; I recommend 0. Then in code you can do things like

dim p as Placard

p = new Placard1 //Placard1 is the name of the control in the window
p.Top = 17

You can also destroy instances of such controls using Control.Close.


Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>