STR #3405

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Post Text | Post File | Prev | Next ]

STR #3405

Application:FLTK Library
Status:5 - New
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:2 - Specific to an operating system
Subsystem:Core Library
Summary:Please add more comments to
Created By:greg.ercolano
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]

No files

Trouble Report Comments:

Post Text ]
Name/Time/Date Text top right image
#1 greg.ercolano
14:21 Sep 25, 2017
This is probably one for Manolo, as I don't think any other FLTK devs knows ObjC.

Since FLTK is predominantly a C++ application, and other languages it uses,
like ObjC, is foreign to most devs, it would help those devs not familiar with ObjC
if code written in that language included  prodigious comments in sections where
the ObjC syntax becomes non-C like.

I'd like to think this code would be commented as if it were example code
for people new to ObjC to understand, so that non-ObjC devs can read it.

I'm trying to debug a problem with the Fl_Native_File_Chooser (specifically,
files not being selected on dialog open), and am fairly lost about what the code does
most of the time.

At one time I could read objc kinda, but after a few years goes by, it's gone again.

If I were leaving myself breadcrumbs, I'd probably do something like this:

  char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] );                                   // get complete URL.path member as a C string
  if ( !(_options & Fl_Native_File_Chooser::SAVEAS_CONFIRM) ) {
    const char *d = [[[[(NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String]; // get just directory part of URL.path as C string

..or if that's too much noise, perhaps instead, some /very/ descriptive
header comments, e.g.

  // NSSavePanel has a URL path member that contains the full pathname to the file.
  //    Here we get the complete pathname as the C string 'q',
  //    and the directory component of the path as the C string 'd'.
  //    We use UTF8String to cast the objc NSString's into C strings.
  char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] );
  if ( !(_options & Fl_Native_File_Chooser::SAVEAS_CONFIRM) ) {
    const char *d = [[[[(NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String];

That'd help a lot I think..?
I'll see about also putting a link to Manolo's ObjC cheat sheet for C++ programmers
at the head of our .mm files to help C++ folks; I think that was posted in a newsgroup
or FLTK article.
bottom left image   bottom right image

Return to Bugs & Features | Post Text | Post File ]


Comments are owned by the poster. All other content is copyright 1998-2023 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.