Author Topic: slide/drag text in canvas  (Read 5292 times)

venkat0249

  • Newbie
  • *
  • Posts: 22
slide/drag text in canvas
« on: August 27, 2011, 02:55:52 PM »
i feel very happy to be one of the users of Hyper next. i'm creating an application using Hyper next creator. In that application i wanna load an image in to canvas, write some text in that image and save that image. I used "CanvasDrawText" command to write text. Is it possible to drag or slide that text from one place to another place with in the canvas? how can i able to  that vary the size and font of that text? means how to use canvas as a "field"?

tigabyte

  • Administrator
  • Newbie
  • *****
  • Posts: 54
Re: slide/drag text in canvas
« Reply #1 on: August 30, 2011, 11:14:14 AM »
i feel very happy to be one of the users of Hyper next. i'm creating an application using Hyper next creator. In that application i wanna load an image in to canvas, write some text in that image and save that image. I used "CanvasDrawText" command to write text. Is it possible to drag or slide that text from one place to another place with in the canvas? how can i able to  that vary the size and font of that text? means how to use canvas as a "field"?

Thats an interesting question but unfortunately there isn’t a simple answer. The main problem is knowing which text is under the mouse and it becomes even more complex if your text uses multiple fonts, styles and sizes.

For dragging a text area about the canvas you could keep a copy of the original canvas in the offscreen buffer (canvas 0) and copy the selected part of the canvas to an image bank for fast copying back to the canvas. Note, to detect canvas mouse drag you need to check for canvas event value 3 inside your canvas's script.

Of course when your draw your text to the canvas you know its placement starting coords. Other canvas functions return the text height and width so giving a bounding rectangle that allows you to copy that text image are.

A good place to start might be to just get your text area to drag within the canvas then you will be able to see what needs refreshing. There is quite a bit in the Language Ref PDF on canvas commands, functions and events.

venkat0249

  • Newbie
  • *
  • Posts: 22
Re: slide/drag text in canvas
« Reply #2 on: August 31, 2011, 06:20:54 PM »
 :) thanks a lot....it given me some idea...

venkat0249

  • Newbie
  • *
  • Posts: 22
Re: slide/drag text in canvas
« Reply #3 on: September 07, 2011, 01:07:11 PM »
can you give me a sample code for that?

 

anything