Sunday, February 23, 2020

#1 2020-02-07 02:42:35 am

maro
Member
From:: Nerima, Tokyo, Japan
Registered: 2004-05-30
Posts: 61
Website

Can we make NSImageView's subview?

I want to make 2 NSImageView within a NSScrollView.

1 ScrollView + 1 NSImageView--> OK
1 croollView + 1 NSImageView + 1 NSIMageView --> NG

Can we make this ?

I want to add scroll view to this program.

https://www.youtube.com/watch?v=WcwToHIKukQ

Applescript:

--
-- AppDelegate.applescript
-- scrollViewWithinMultiImageView
--
-- Created by Takaaki Naganoya on 2020/02/07.
-- Copyright © 2020 Takaaki Naganoya. All rights reserved.
--

script AppDelegate
   property parent : class "NSObject"
   
   -- IBOutlets
   property theWindow : missing value
   
   on applicationWillFinishLaunching_(aNotification)
       set wFrame to theWindow's frame()

       set tmpScrol to current application's NSScrollView's alloc()'s initWithFrame:wFrame
       set aIMGV to current application's NSImageView's alloc()'s initWithFrame:wFrame
       set bIMGV to current application's NSImageView's alloc()'s initWithFrame:wFrame

       set aImage to current application's NSImage's imageNamed:(current application's NSImageNameComputer)
       set bImage to current application's NSImage's imageNamed:(current application's NSImageNameComputer)

       aIMGV's setImage:aImage

       tmpScrol's setDocumentView:aIMGV
       aIMGV's addSubView:bIMGV
       --tmpScrol's addSubView:bIMGV

       theWindow's setContentView:tmpScrol
   end applicationWillFinishLaunching_

   
   on applicationShouldTerminate_(sender)
       -- Insert code here to do any housekeeping before your application quits
       return current application's NSTerminateNow
   end applicationShouldTerminate_
   
end script

Model: MacBook Pro 2012
AppleScript: 2.7
Browser: Safari 13.0.1
Operating System: macOS 10.14

Last edited by maro (2020-02-07 02:43:43 am)


I wrote thousands of AppleScript to realize my idea. Natural language interface, voice recognition commander and so on. Though my mother toungue is strange language, Japanese, my most frequently write language is AppleScript. I believe it is for making things easy and powerful.


Filed under: SubView

Offline

 

#2 2020-02-07 05:18:11 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6192

Re: Can we make NSImageView's subview?

I don't think so. I suspect what you need is something like an NSCollectionView.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#3 2020-02-07 06:16:34 am

maro
Member
From:: Nerima, Tokyo, Japan
Registered: 2004-05-30
Posts: 61
Website

Re: Can we make NSImageView's subview?

Oh....Thank Shane.

NSCollectionView seems very useful. But it seems to support grid layout only.
Honeycomb style layout seems not to be supported, I think.


I wrote thousands of AppleScript to realize my idea. Natural language interface, voice recognition commander and so on. Though my mother toungue is strange language, Japanese, my most frequently write language is AppleScript. I believe it is for making things easy and powerful.

Offline

 

#4 2020-02-07 07:27:23 am

maro
Member
From:: Nerima, Tokyo, Japan
Registered: 2004-05-30
Posts: 61
Website

Re: Can we make NSImageView's subview?

Shane Stanley wrote:

I don't think so. I suspect what you need is something like an NSCollectionView.



aIMGV's addSubView:bIMGV



Applescript:

aIMGV's addSubview:bIMGV

This worked!  It was my mis-spelling....


I wrote thousands of AppleScript to realize my idea. Natural language interface, voice recognition commander and so on. Though my mother toungue is strange language, Japanese, my most frequently write language is AppleScript. I believe it is for making things easy and powerful.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)