Lazarus
Home
Forum
Help
TinyPortal
Search
Login
Register
Lazarus
»
Programming
»
Widgetset
»
Cocoa
»
macOS Extensions
Free Pascal
Website
Downloads
Wiki
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
FAQ
Wiki
Bugtracker
Packages
IRC channel
Developer Blog
Follow us on Twitter
Latest SVN
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
Search
Advanced search
« previous
next »
Print
Pages: [
1
]
Author
Topic: macOS Extensions (Read 262 times)
skalogryz
Global Moderator
Hero Member
Posts: 1904
macOS Extensions
«
on:
April 15, 2018, 08:03:27 pm »
A little bit more of native macOS in LCL apps:
http://wiki.freepascal.org/macosext
Logged
https://havefunsoft.com
ChrisR
Jr. Member
Posts: 53
Re: macOS Extensions
«
Reply #1 on:
April 24, 2018, 03:56:45 pm »
These features are really useful. Dark mode is great for radiology, I have employed your code into my Lazarus based MRI viewer
https://github.com/neurolabusc/MRIcroGL/issues/20
I think this does a nice job of encapsulating useful MacOS features without interfering with the core LCL features and 'write once, compile everywhere' nature.
I do have two suggestions. I understand you are busy implementing core LCL Cocoa features, so these are low priority (want, not need). However, MacOS does provide two handy features that seem like a natural fit for your component:
1.) NSAlert is like a modal message, but it is attached to one specific form. This is great when you are using multiple applications, as it is obvious which form is the parent. A handy feature for your component would be to present a string of text for the user.
2.) NSUserNotification can be used for a lot of features. However, the easiest to implement for Lazrus, and a hugely influential role is to report a brief message that does not require any user intervention. This will tell the user something is happening, without requiring a modal response. For Lazarus, providing a string text message and a delay would be great.
Below are two XCode snippets to demonstrate these. These are both from my open source project
https://github.com/neurolabusc/MRIcro
This is available in compiled form with MRIcroGL
https://github.com/neurolabusc/MRIcroGL/releases
The NSAlert is shown when you File/Open an image and then press the 'i' button, the Notification is shown when a user has the "Only initial volumes" preference checked and they load a huge 4D dataset: in this case only the first 1 Gb of images are loaded, and the notification tells the user that they are only seeing part of the dataset (and how to remedy this).
- (IBAction)notifyNotAllVolumesLoaded: (int) loadedVols RawVols: (int) rawVols;
{
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = [NSString stringWithFormat:@"Loaded %d of %d volumes", loadedVols, rawVols];
notification.informativeText = @"Reason: The preference 'Only initial volumes' is selected";
notification.soundName = NULL;
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
[NSTimer scheduledTimerWithTimeInterval: 4.5 target:self selector: @selector(closePopup) userInfo:self repeats:NO];
}
- (IBAction)infoClick:(id)sender { //
NSString *message = [niiGL getHeaderInfo];
NSBeginAlertSheet(@"Header Information", @"OK",NULL,NULL,theWindow, self,
NULL, NULL, NULL,
@"%@"
, message
);
}
Logged
ChrisR
Jr. Member
Posts: 53
Re: macOS Extensions
«
Reply #2 on:
April 24, 2018, 04:39:31 pm »
By the way, I note that there is other available code for NSUserNotification
https://forum.lazarus.freepascal.org/index.php/topic,23977.15.html
To get the code to compile with Cocoa SVN 1.9, I needed to change the Uses, so "CarbonProc" becomes "CocoaUtils". I still think it might be nice to use your component as a wrapper for this function, to keep the Cocoa-specific features available.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Programming
»
Widgetset
»
Cocoa
»
macOS Extensions
Recent
Visual Pascal Community E...
by
RAW
[
Today
at 08:10:09 pm]
Bug in procedure Image of...
by
menegaz
[
Today
at 08:06:04 pm]
AutoSave feature?
by
lainz
[
Today
at 08:05:25 pm]
New version of BGRABitmap
by
lainz
[
Today
at 08:03:17 pm]
Lazarus SQLQuery BCDField...
by
valdir.marcos
[
Today
at 08:00:33 pm]
IDE output window shown, ...
by
Handoko
[
Today
at 06:59:05 pm]
Linux TUN
by
Hiko222
[
Today
at 06:23:57 pm]
Make StringList from Unic...
by
marcov
[
Today
at 06:15:14 pm]
Cannot center image in tS...
by
CM630
[
Today
at 06:12:19 pm]
[Solved] Delphi alternati...
by
lainz
[
Today
at 05:35:30 pm]