🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
4 messages
4 total messages Started by Jeff Kish Wed, 26 Mar 2003 20:57
drag and drop mouse
#17415
Author: Jeff Kish
Date: Wed, 26 Mar 2003 20:57
39 lines
1890 bytes
Greetings.

Is there a code snippet appropriate for cbuilder that shows the best
way to display a image/wireframe/box/whatever when the user is
operating the mouse to select stuff (i.e. between the mouse down and
mouse up)?

I have some c code that does it, but I thought there might be a better
way to to it in cbuilder, given all the events it allows you to
capture. I am dealing with a TPanel on a form.

Thanks
Jeff
p.s. the c code basically does this upon a mouse down message:

set capture
//eat mouse messages until a wm_lbuttonup is encountered
//meanwhile drawing your desired box/rubberband/whatever
for (;;)
{
	if (PeekMesage(msg, 0, WM_MOUSEFIRST, WM_MOUSELAST,
PM_REMOVE))
	{
	    DrawStuff();
	   if (msg.message == WM_LBUTTONUP)
	   {
	      result = true;
	   break;
	   }
	   if (msg.message == WM_RBUTTONUP)
	   {
	      result = false;
	      break;
	   }
	   continue;
	}
	ReleaseCapture();
	return result;// true means something was captured
}
Re: drag and drop mouse
#17406
Author: Rodolfo Frino - Stargate Softwar...
Date: Wed, 26 Mar 2003 21:30
42 lines
2178 bytes
You can create (or maybe display) a "box" (in this example a TRichEdit
control)
when the mouse goes down on your panel, and destroy (or maybe hide) the
"box"
when the mouse goes up on your panel (or held down and moved away from the
panel
and then released) by using the  event handlers corresponding to the
OnMouseDown and OnMouseUp events:

TRichEdit* p1;

void __fastcall TForm1::Panel1MouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
  if (Button == mbLeft)
  {
      // Create your component here
      p1 = new TRichEdit(this);
      p1->Parent = this;
      //...
  }
}


void __fastcall TForm1::Panel1MouseUp(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
  if (Button == mbLeft)
      delete p1;         // Destroy your component here

}

Rodolfo

"Jeff Kish" <jeff.kish@mro.com> wrote in message
news:ri448vcicvl3p405t80aohjaeancic9b93@4ax.com...
> Greetings.
>
> Is there a code snippet appropriate for cbuilder that shows the best
> way to display a image/wireframe/box/whatever when the user is
> operating the mouse to select stuff (i.e. between the mouse down and
> mouse up)?
Re: drag and drop mouse
#17398
Author: Rodolfo Frino - Stargate Softwar...
Date: Wed, 26 Mar 2003 21:32
3 lines
1029 bytes
I forgot, this solution uses VCL not API's

Rodolfo
Re: drag and drop mouse
#17200
Author: Jeff Kish
Date: Wed, 02 Apr 2003 18:54
57 lines
2765 bytes
On Thu, 27 Mar 2003 08:30:46 +1100, "Rodolfo Frino - Stargate
Software" <starcinema@eftel.com> wrote:

>You can create (or maybe display) a "box" (in this example a TRichEdit
>control)
>when the mouse goes down on your panel, and destroy (or maybe hide) the
>"box"
>when the mouse goes up on your panel (or held down and moved away from the
>panel
>and then released) by using the  event handlers corresponding to the
>OnMouseDown and OnMouseUp events:
>
>TRichEdit* p1;
>
>void __fastcall TForm1::Panel1MouseDown(TObject *Sender,
>      TMouseButton Button, TShiftState Shift, int X, int Y)
>{
>  if (Button == mbLeft)
>  {
>      // Create your component here
>      p1 = new TRichEdit(this);
>      p1->Parent = this;
>      //...
>  }
>}
>
>
>void __fastcall TForm1::Panel1MouseUp(TObject *Sender, TMouseButton Button,
>      TShiftState Shift, int X, int Y)
>{
>  if (Button == mbLeft)
>      delete p1;         // Destroy your component here
>
>}
>
>Rodolfo
>
>"Jeff Kish" <jeff.kish@mro.com> wrote in message
>news:ri448vcicvl3p405t80aohjaeancic9b93@4ax.com...
>> Greetings.
>>
>> Is there a code snippet appropriate for cbuilder that shows the best
>> way to display a image/wireframe/box/whatever when the user is
>> operating the mouse to select stuff (i.e. between the mouse down and
>> mouse up)?
>
Thanks for the reply. I am not sure I made myself clear, but  it seems
like this is a different way of approaching the problem.
I just want to be able to have a wire-frame box like so many apps do
when selecting an area to "select" or "zoom".

I was actually looking for a vcl friendly way to do this, or perhaps
find out if there was reasons the way I had mentioned were not
advisable.

Thanks again,
Jeff Kish
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads