objective c - Adding Disclosure button and NSTextView to NSAlert -
i want display nsalert accessory view. accessory view needs have:
1) nstexview displaying mandatory contents
2) disclosure button nstextview
the disclosure button required hide , show second nstextview. however, @ same time want nsalert dialog resize accomodate , fit contents. save dialog in cocoa has disclosure button , want same functionality nsalert. suggestions?
here go:
1) nsalert has window property. hence use that.
2) create custom accessory view containing 2 nstextview's , disclosure triangle
3) set custom view accessory view of nsalert
4) before displaying alert, set window property of nsalert in custom view (this way have access nsalert's window when click disclosure triangle)
5) add target disclosure button event , save state (expanded/collapsed)
6) in event disclosure triangle click: use nsalert's saved window frame adjust height, size , width of nsalert.
7) important here note - when adjust height, nsalert grows top hence required move "origin" accordingly.
hope helps :). had spend entire weekend figure out how :d. btw, out of curiosity project or company working on?
Comments
Post a Comment