-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSTextView and NSDocument #47
Comments
Yup, this is pretty much just a case of those things not being necessarily ported yet. You probably want an approach that's a mix of 1 and 2. If you look at e.g (If |
Sorry it took me so long to follow up. I think I've taken on too much at once (rust, mac os api, and ui/ux). I tried to copy the code from I've tried putting print statements in the call backs and my TextViewDelegate and it seems to be registered properly. The call backs in the TextView itself for editing don't fire. I don't know where to go from here. I think part of the issue is I don't understand how we are actually interfacing with Objective-C. I'm using msg_send!() macros a lot in my If you're willing, I'll submit a pull request so maybe you or other people can look at what I've done wrong. If not, I'll close this issue and try a more familiar front end for my rust text editor. Thank you for your time! |
Feel free to open a PR or link a sample repo, I'm happy to take a look. :) |
Checkout the |
I'll have to look more over the weekend, but at a glance, you're calling (pseudo-code, you can dig around for the imports) let zero: CGRect = Rect::zero().into();
let alloc: id = msg_send![class, alloc];
msg_send![alloc, initWithFrame:zero] If memory serves correct you may also have to fiddle with AutoLayout for it - it also looks like you're pinning |
You were right, my auto layout was messed up. I fixed it and tested it with a normal view and now it should work properly. I also realized I was calling the wrong functions for registering the class. Or maybe they were correct and just poorly named. My plan is to try to closely compare with the view module until I can see the textview showing up with a background color. |
Closing this for now, but feel free to reopen if you end up with more questions~ |
I also really need this, so can we consider reopening? |
It can be open, sure - but for this particular thing I'm mostly looking for people who will issue a PR. I don't have the time for this particular piece myself. I may get to it in the future if it crosses over with something I'm building though. |
I'm trying to learn rust by writing a simple plain text editor. I followed this tutorial in Swift and I have a working prototype. I'm trying to port it to rust using your library, but I can't find NSTextView or NSDocument. In the README you mention:
I'm new to UI development on the mac, but it seems like there are several way forwards here:
I saw in this example that you said
So it seems like you plan on supporting a Document Based App use-case.
It would be very helpful to me if you could point me in the right direction, or provide an example document based app example (maybe along the lines of the tutorial linked earlier). If this is too much to ask, you can also just close this issue without comment. Thanks for you time!
EDIT: clarity
The text was updated successfully, but these errors were encountered: