How does GetLastActivePopup work? - winapi

I'm trying to apply the techniques of GetLastActivePopup.
I was wondering how does GetLastAcitvePopup work? Is there like a window property or something it checks?
Does anyone know where I can find the SourceCode of this function? THat would help me a lot.
Thanks

Each window in the system has an internal, non-public, non-documented, data structure and one of the fields in that data structure is used to keep track of its last active popup's HWND.
Seeing the source code of the GetLastActivePopup function would not be very enlightening since all it would do is return the value of that data field.
Whenever a new window is activated, Windows looks to see if it has an owner (and if that owner has an owner, and so on). If so it then records the newly activated window as that owner's last active popup.

Related

Nativescript - Add to favorites/featured

I´m in that point on my app where i need to give the user the ability to save to favorites. To be more specific, let´s say that he´s seeing a list-view and then presses one of the listitems which takes him to the detail of that item...here i have a star icon that when pressed it should save that item and then if he navigates to the favorites page, he will see another listview with all of the favorites.
but i´m stuck on how to accomplish this, the only thing that comes to my mind is the application settings...it should be a dynamic array that always exists and then keeps adding or deleting objects(favorites).
Any thougts on this? can anyone suggest me an approach? maybe a better one?
Regards
You may use the nativescript-localstorage plugin which internally uses file system only and takes care of reading / updating JSON file as needed.

Uniquely identifying an NSScreen

I'm working on a project which has settings for each display. I want my application to support a display being removed and later re-added, possibly with another display used in between, with the original settings for each display being applied when the display is seen again.
As far as I can tell there is no way, through NSScreen, to uniquely identify one outside of the context of the current display configuration. I can't just use screen dimensions/properties as the user could have multiple displays of the same model in different locations; this problem applies to all persistent properties of a screen as far as I can tell.
Is there a good, known way to do this?
Thanks for your time. Any help is greatly appreciated.
The documentation to -[NSScreen deviceDescription] talks about getting the CGDirectDisplayID and the documentation about the CGDirectDisplayID says:
When a monitor is attached, Quartz assigns a unique display identifier (ID). A display ID can persist across processes and system reboot, and typically remains constant as long as certain display parameters do not change.
When assigning a display ID, Quartz considers the following parameters:
Vendor
Model
Serial number
Position in the I/O Kit registry
This sounds pretty close to what you are looking for.

ESRI - Arcmap help to create a button that will populate current date for selected features

I would like to create a custom tool or button in Arcmap that programmatically fills in a number of attributes of selected features for a layer.
To keep things simple, lets say my Arcmap project only has one SDE layer, and I'd like to populate the Date_Created field.
The SDE layer being edited is versioned.
I have some code that partially works, but after the selected records are updated, the layer can no longer draw stating it's in a closed State.
link text
I appreciate any suggestions on how to accomplish this.
Thanks,
Frank
I think that this behavior may be related to management of the edit operations in your script.
Any edit operations that you start must either be stopped (completed) or aborted. If no features have been edited, the edit operation needs to be aborted.

Trouble with data not saving with bindings and shared NSUserDefaults in IB

I'm having a bit of a strange issue that I can't quite figure out. I'm somewhat of a n00b to Interface Builder. What I am trying to do seems like it should be simple, but it's not working for some reason.
In interface builder I have a preferences window with a simple NSTextField. I have set the value binding to the Shared User Defaults Controller with the controller key "values" and model key "test". I build/run my app and open the preferences window, type some random value into said text field, close the window. Command-Q the app. Then in a shell i do a "defaults read com.xxx.yyy" for my app and the key and value are nowhere to be found. That being said, it seems like the next time I fire up the app and change the value it works but only if I switch focus off of the NSTextField before closing the window.
In the documentation for NSUserDefaults it says that the shared controller saves values immediately, am I missing something stupid here?
Thanks for any help.
I'm answering this a long time after it was asked in case others find it useful.
It sounds like you need to set "Continuously Updates Values" for the text field you've bound. Otherwise, the value is only sent and, accordingly, the preferences only updated when something happens to 'finalise' the edit. That's usually triggered by pressing Return and probably also happens when you switch focus away from the window (though I just tested this in one of my own applications and it didn't seem to commit the edit).

Janus GridEX Problem

It's a longshot that anyone can help with this, but here goes. I inherited a VB6 app with a Janus GridEX control. It iterates through records, and is editable. Problem is, if I edit a cell and hit the button to go to the next record, the change is applied to the next record, not the one I was editing. It's like, I need it to finish up the edit before going to the next record. I've had this sort of problem before in VC++, and sometimes you have to "KillFocus" on the control you're on or something. I just don't know what to do here. I tried sending a carriage return, since if you return out of the edit cell, it works, but sending a carriage return manually doesn't work. What's the secret?
Is your grid bound or unbound?
It's hard to tell from your description, but I imagine that if your are having this problem then it's probably bound.
As the other answer asked, is the button the RecordNavigator that is built into the control or is it a separate button? The reason I bring this up again, is that I have seen issues in the VB6 applications I support where a toolbar will often intercept and interfere with how the JanusGrid should work.
To get around this limitation, I have added the following code in the click handler of any toolbars where there is also a JanusGrid control on the form.
If jsgxYourGridName.EditMode = jgexEditModeOn Then jsgxYourGridName.Update
This way any changes are immediately applied to the current row.
If this does not help, then I have also seen problems where the recordset that is bound to the grid gets out of sync with the internal recordset in the grid. You can check this by comparing the bookmark of the grid to the bookmark of the recordset.
Ie. mrsYourRecordset.Bookmark = jsgxYourGrid.ADORecordset.Bookmark
At one point I may have also used something like this.
jsgxYourGrid.ADORecordset.Bookmark = jsgxYourGrid.RowBookmark(jsgxYourGrid.RowIndex(jsgxYourGrid.Row))
Finally you can try setting a breakpoint in the BeforeUpdate, RowColChange and/or AfterColUpdate events of the grid, to see what record the grid is really on when clicking on the button.
It depends whether the button is internal to Janus GridEX or not. If it internal then just about the only thing you can do is look at the events the control exposes to see if there a sequence that can let you know that this problem occurs. Then you can try to take corrective action by restoring the row you moved to and put the edit in the row you left.
If the button is external to Janus then you can use the debug mode to trace sequence of statement that control the transfer of focus to the next row. It could be something out of order or a side effect of the particular sequence of commands. I have run into both with different controls.
Remember that you can edit while in debug mode so you can try different approaches and test until you find one that works.

Resources