Useful methods that you didn't notice straight away


#1

I don’t know about anyone else, but I seem to keep finding really useful methods in JUCE that I didn’t notice straight away, or which aren’t where I’d expect them to be, so I’m wondering if it would be a good idea to start a thread to list them?

For example, two of my recent discoveries are:

Font::setDefaultSanSerifFontName() : Sets the default font JUCE uses - useful for skinning etc.
File::startsAsProcess() : Attempts to launch the file as an executable, or open it with the default application associated. I actually wrote a whole class (cross-platform too) to do this myself, before I realised JUCE could already do it for me.

So anyway, is this a good idea, or am I the only one who doesn’t read the docs properly? :stuck_out_tongue:

  • Niall.

#2

Very good idea!

Here’s a couple of suggestions (I’m sure there’s plenty more):

PropertiesFile::createDefaultAppPropertiesFile()
the ComponentDragger class
MouseHoverDetector
SystemStats::getUserHomeDirectory


#3

[quote=“jules”]the ComponentDragger class
MouseHoverDetector[/quote]
:shock: I hadn’t noticed those two - I can imagine a number of cool things I could do with ComponentDragger…

Anyone else?

  • Niall.

#4

StretchableLayoutManager and Viewport classes are useless ?


#5

I just discovered the PropertiesFile class - right when I needed it, too.

Matt


#6

Too many to mention! :oops:

I think the JUCE official slogan should be “Woaw! When the fuck did that appear!?”


#7

in fact I’ve only just “discovered” the AudioSampleBuffer.

I knew it was there but I didn’t trust it! :lol:

I needed to learn pointer-fu so I did all the audio manually (so to speak)

The irony is that now I know how to do it, I’ve started using the AudioSampleBuffer!

anybody else insist on doing it yourself sometimes just to learn?

I’ve also started drilling into the juce code a lot more…

THERES NOTHING THERE!!!

I expected rafts of complex code but theres just a few casual lines here and there! But fuck me it works.

In fact my work work has improved in that I write fewer lines of code but accomplish more quicker.

sorry for waffling guys…


#8

[quote=“Karbon L. Forms”]I think the JUCE official slogan should be “Woaw! When the fuck did that appear!?”[/quote] :lol: :wink:

I just found another one, which would have been really helpful if I’d noticed it a couple of months ago: the TextLayout class, to let you find out how many pixels a line of text will take up.

  • Niall.

#9

[quote=“NiallM”][quote=“Karbon L. Forms”]I think the JUCE official slogan should be “Woaw! When the fuck did that appear!?”[/quote] :lol: :wink:

I just found another one, which would have been really helpful if I’d noticed it a couple of months ago: the TextLayout class, to let you find out how many pixels a line of text will take up.

  • Niall.[/quote]

…and if you’re just measuring the width of a line, it’s also probably easier to use the Font::getStringWidth() method.


#10

:oops: How long’s that been there? I distinctly remember spending a good couple of days looking through the Font (and GlyphArrangement, and String…) documentation for that exact method a couple of months ago…

  • Niall.

#11

:oops: How long’s that been there? I distinctly remember spending a good couple of days looking through the Font (and GlyphArrangement, and String…) documentation for that exact method a couple of months ago…

  • Niall.[/quote]

sorry… it’s been there for years!


#12

Doh! Looks like I need this thread more than anyone else…

  • Niall.

#13