Montag, 13. Mai 2013

ObjectStudio 8 New UI

The newest preview version of ObjectStudio 8.5 does include a preview package for the new UI framework. You must load the package using the parcel manager (Directories => parcels/preview)

The new UI is based on the Win32 APIs, MFC seems not to be used any more.

The base class is ObjectStudio.UIView. There is a class TestUI which one can use as a demo controller. The API calls are implemented in ObjectStudio.UIView.UILib.

To display a new empty window without any icons:

UIView initialize.
UIView new create.


 

I had to change the create and privateCreate methods in UIView to get this working.

create
    self isOpen ifTrue: [^self].
    UIView critical: 
            [self class createWindow: self.
            "hhk := self hookWindowCreate." 
            [self privateCreate] ensure: 
                    [self class createWindow: nil.
                    "self unhookWindowCreate: hhk"]]

privateCreate

    | aHwnd |
    aHwnd := self lib
                CreateWindowEx: self wndExStyle
                class: (self class wndClassName isString
                        ifTrue: [self class wndClassName gcCopyToHeapUnicode]
                        ifFalse: [self class wndClassName])
                window: self windowName gcCopyToHeapUnicode
                style: self wndStyle 
                x: self position x
                y: self position y
                width: self extent x
                height: self extent y
                parent: (self parent isNil ifTrue: [0] ifFalse: [self parent windowHandle])
                menu: 0
                hInst: 0
                lParam: 0.

    self windowHandle: aHwnd datum .
    self registerWindow: aHwnd datum.

    aHwnd datum = self windowHandle
        ifFalse: 
            [(UICreateWindowExError new)
                originalHwnd: self windowHandle;
                newHwnd: aHwnd datum;
                raiseSignal]


If you want a window with the standard windows icons:

(UIView new)
    style: UIView defaultStyle;
    create;
    setDefaultEvents.


In the TestUI class they do it a bit different (also this code does not display the left icon):

TestUI new testOpenWindow


Download code from here.
See also this post from Cincom.

Keine Kommentare: