Adding comments to xib file - objective-c

I am working on xib file that has many objects, which hide each other and also change in code.
I would to make my work, and any other future programmer easier by adding comments in the xib file.
I thought of just putting some text area outside the view I'm using, but I want to make sure I'm not effecting the final executable.
Is this a valid way to do it?

1./ In interface-builder, select the object to comment, open the inspector:
in the last tab (with the (i) icon, at the bottom of the inspector panel, you'll see a note area: write your comments there. You may want to click on "show with the selection".
2./ comment in code any object that should change programmatically

Related

How to use the GtkHeaderBar in glade 3.20?

I tried to do a GtkHeaderBar application with glade 3.20, but I have the oldschool bar on top every time, when creating my python app.
In glade 3.19, checking the client-side decoration property created a line on top, in which I could put the GtkHeaderBar. This is not the case in the latest version.
I tried to check/uncheck every property, I could not find the way to do this. That is very surprising, since this should be the default way to do a Gnome application.
I looked on the internet, but there is dramatically no documentation on glade…
After searching, it seems that I must add a GtkHeaderBar as child in the main window. But how, that is the mystery.
Create the window, set the "Client side window decorations" property to True. Next, get the HeaderBar widget from the toolbox and drop it on the top part of the window that just appeared:
And here you are, the header bar:
Ok, I found by myself a workaround:
We need to create the GtkHeaderBar apart, and after activating the client side decoration property, we close the project. Then, by editing the XML file, we put the header bar section into the titlebar section, instead of the placeholder xml tag. When we reopen the glade project, that's ok, the header bar is in the window.

Cocoa Custom Status Menu with text view

I've created a status menu following some hints here and sone from other sites. It shows a an NSTextView as a line item and has check spelling as you type on, which is exactly what I want (quick way to check a misspelled word). The text view area behaves as expected by highlighting the misspelled word and all.
All works well except for one thing: when I "Control-click" on the misspelled word to get options or guesses on the possible correctly spelled word, it does not popup the context menu.
In Interface Builder I've linked a list item to a custom view containing the NSTextView ... I can send the xcode project code to anyone who would like to examine it further. As a reference I followed this video: http://www.youtube.com/watch?v=HRPMFNDcfLY and modified it slightly.
I'm a beginner, so please be kind; any hints or tips would be much appreciated. Thanks ...

Modifying window style by editing binary?

CyLog’s WildRename is a good program for performing batch-renames on files. The problem with it is that while the main window is resizable, it does not have the maximize box which makes it a little frustrating to size and use. Moreover, they have not made any updates in a long time, so the program is essentially discontinued.
I ran WildRename and used WinSpy++ to modify the style of its window to manually include the WS_MINIMIZEBOX style and bam!, it was now functioning as expected.
The question now is how to make this permanent.
My first instinct was to fire up ResHacker, but the problem is that the style that needs to be modified is that of the main window of a non-dialog application, so ResHacker has no way of doing this.
The next thing I tried was to open it in a hex-editor, to find the address(es) of the string corresponding to the titlebar. I then opened the file in W32Dasm and located the address of the code that references the address of the titlebar string. I did all this in an attempt to find the location of where the main dialog is created so that I can modify the style passed to CreateWindow(). Unfortunately, I cannot find a call to CreateWindow anywhere near the reference to the titelbar string and none of the calls to CreateWindowEx that I can find seem to be (obviously) the ones used to create the main window.
Is there an easy/automated way of modifying the style of the main window (assuming a non-dialog application)?
You could use a debugger like OllyDBG to dump the exe memory after the edit with WinSpy++, then use that exe or compare the files to see where the change is if you want to see what you've missed
There has to be a call to CreateWindow/Ex(), especially if it not a dialog from a resource. You just need to look harder. I would use IDA instead of WinDasm. It will decompile the assembly into more understandable code, and it has a built-in debugger. You can put a breakpoint on the title string and see in real-time which code actually touches it, and then follow it back to the accessing code.

How to add a button to the main toolbar in Eclipse programmatically

I've a question. I cannot find the way, how to add buttons to main toolbar programmatically. My problem is, that I've the task to dynamically (based on XML configuration file) build menus and toolbar. I found how to add a menu item programmatically, but not toolbar button.
Tutorials mostly show how to create buttons and menus using plugin descriptor (plugin.xml), but not how to do it programatically. It seems, that it is out of bounds of Eclipse plugin philosophy.
I've just found this:
There might be layout problems with this approach. I also don't
believe the framework will try and re-create your dynamic item except
at random toolbarmanager updates. With Menus they can be updated on an
SWT.Show event, which is why CompoundContributionItem only applies to
Menus.
What shall I do? Can I say Sorry, there is no way to build toolbar dynamically. I can do it just for menus? Collegue says, that it must be possible, but he does neither know how.
The only way to be able to create main toolbar entries programmatically is in an RCP app, where you supply the ActionBarAdvisor for the workbench window. This isn't dynamic, however, just called on window creation.
Another way to do it would be to use org.eclipse.ui.menus and contribute org.eclipse.ui.menus.ExtensionContributionFactory. It also works only on workbench window creation (not really dynamic), but you could read your own XML and provide IContributionItems for the main menu or toolbar.
How dynamic are you trying to be? Most solutions work well on startup/window creation.
PW
Whenever you try to do something programmatically in Eclipse that is normally done through plugin definitions you are walking on thin ice. I've tried it on a few occasions and it rarely ended up being easy or good.
Instead, think of what it is that you only know at runtime and need to be able to change on the fly. Is it the name or icon of the button? That can be changed at runtime.
Take a look at runtime commands, they can be confusing to define properly, but with them you can for example create buttons that are only visible if a condition is active. That condition could be set at runtime.

Is there a way in Intellij IDEA to see the name of the method the current line belongs to?

In our code base there are a few very long methods (several pages worth of code). When reading the code, it would sometimes be good to be able to see the name of the method the current line belongs to, without paging up to the beginning of the method. Is this possible in Intellij IDEA? I am using Intellij IDEA 7.0.3.
You can use View | Context Info (Alt+Q, Ctrl+Shift+Q on Macs). It will display a pop-up on the top of the editor with the current context information (class/method signature).
IntelliJ 2018
This is shown by default at the bottom.
Unfortunately, the method is shown only by name (not including the parameters). If a method is overloaded you won't know for sure where you are.
If you want to move it from bottom to top, go to File > Settings... > Editor > General > Breadcrumbs > check Top:
In the structure panel select the "Autoscroll from source" option.
This way when you place the cursor inside any method the structure panel will show which method you're in.
Intellij now has support for breadcrumbs. Go to settings > appearance and tick "Show breadcrumbs". In this way you can view class/method name without Alt+Q.
For some reason (Alt-Q) wasn't consistent in Android Studio for me. I find (Ctrl-F12) to be pretty satisfactory for this purpose (Navigate|File Structure) though it can be a little laggy in larger files. And by pressing the hotkey again it will populate the list with all the inherited methods as well.