Any way to insert graphic into TextArea??

Do you know where to enable this feature? The shortcut doesn‘t work for me, and the workaound with the glyph view window is much more time-consuming.

[quote=128559:@Axel Schneider]Tipp: In Mavericks you can hit CTRL + CMD + SPACE on Push Button - Caption Field ,there are some icons
[/quote]

When I hit Ctrl+Cmd+Space it displays the Special Characters utility from Edit menu :frowning:

thats right, for me too,

there are several pages, first page is ‘last used’ , so it will look at you a little differently

[quote=128867:@Axel Schneider]thats right, for me too,

there are several pages, first page is ‘last used’ , so it will look at you a little differently

[/quote]

Alright. Now I understand. Fascinating font this Apple Color Emoji.

The most amazing thing is that although it is a TTF font, it seems to be bitmapped. Yet, I was not able to open it with Bitfonter, the only modern OpenType bitmap font editor for color fonts available at this moment.

Apple is using a proprietary format : http://typographica.org/typeface-reviews/apple-color-emoji/

Thank you Axel.

??? Surely if you pasted in an emoji via the above method, it would cause unexpected characters if the user is using an older version of the OS?

it should work from OSX 10.7 and higher

There is another way : use TextEdit to fetch and display the character, then Cmd-Shift-4 to make it a picture.

moved the Example Download to DropBox

Example Download

Also interesting is the fact, if you use declare ‘readRTFDFromFile’ to open files, it works for txt, rtf, rtfd and html files.

with the help of Sam Rowland’s advice (Forum Post 51756) I made a method to store the textarea as PDF

Action:

  dim s as String
  dim PDF_file as folderitem
  dim dlg as new SaveAsDialog
  dlg.Filter=FileTypes1.Pdf
  dlg.SuggestedFileName = "test.pdf"
  PDF_file = dlg.ShowModalWithin(mainwin)
  if PDF_file <> nil then
    s = exportTextAreaAsPDF(TextArea1, PDF_file)
  else
    return
  end if

Method:

Function exportTextAreaAsPDF(myArea as TextArea, inFile as folderitem) As String
  Dim errorMessage as string
  #if TargetCocoa then
    
    declare function documentView lib "Cocoa" selector "documentView" _
    (obj_id as Integer) as Ptr
    dim myTextArea as ptr
    myTextArea = documentView(myArea.Handle)
    // - Get the 'bounds' from the underlying NSView.
    Declare function getBounds lib "Cocoa" selector "bounds" _
    ( NSViewHandle as ptr ) as NSRect
    Dim r as NSRect = getBounds( myTextArea )
    
    // - Now request the PDF data (NSData) from the NSView, passing in the bounds.
    declare function dataWithPDFInsideRect lib "Cocoa" selector "dataWithPDFInsideRect:" _
    ( NSViewHandle as ptr, aRect as NSRect ) as Ptr
    Dim NSDataRef as Ptr = dataWithPDFInsideRect( myTextArea, r )
    
    if NSDataRef = nil then
      errorMessage = "Failed to get the PDFData"
      
    else
      // - Now we have a NSData object, lets get the length or size of it.
      declare function getlength lib "Cocoa" selector "length" ( ref as Ptr ) as integer
      dim blockLength as double = getLength( NSDataRef )
      
      // - Create a memoryBlock with the same size as the NSData object
      Dim data as new MemoryBlock( blockLength )
      
      if data = nil or data.size = data.sizeUnknown or data.size = 0 then
        errorMessage = "Failed to allocate enough memory to prepare writing to disk"
        
      else
        // - Send the NSDataRef the "getBytes" message and give it our memoryBlock.
        declare sub getBytes lib "Cocoa" selector "getBytes:length:" ( ref as Ptr, bytes as Ptr, length as integer )
        getBytes( NSDataRef, data, blockLength )
        
        Try
          // - Create the binaryStream
          Dim bis as binaryStream = binarystream.create( inFile, true )
          
          // - if the file already exists, set it's length to zero so that we don'e have any extra data left over from before.
          if bis.length <> 0 then bis.length = 0
          
          // - Write the memoryBlock to disk, then close the stream.
          bis.write data.stringValue( 0, data.size )
          bis.close
          
          // - let the developer know that we completed this task.
          Return ""
          
        Catch err as RuntimeException
          
          // - If we encountered an error in this chunk, then we must notify the user.
          errorMessage = err.message
          
        End Try
      end if
    end if
  #else
    errorMessage = "PDF export is not supported in this version of the application."
  #endif
  
  Return errorMessage
End Function

I made a subclass of the TextArea, where you can adjust everything in the IDE (OSX)

Example

it seems that the xojo . io zip file is corrupt - https://xojo.io/4186c2fb239c

https://www.dropbox.com/s/jtxghlpe7v3b5mj/TextAreaClass3.zip?dl=1

Axel, how do you use the “edit image” property in your (wonderful) textarea ?
I can paste, move images I drop in the textarea. what is “editing” consisting of ?

Fixed the .io file too, just shoot me a message if you come across them.