123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|390|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Off Topic -> Dev on Pi - Success

Mon, 21 Jan 2013, 17:13
Jayenkai
\o/yeay\o/
Mon, 21 Jan 2013, 17:13
Dabz
Wahoooo Linkage ! *.Left of the image*

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Mon, 21 Jan 2013, 18:27
steve_ancell
Looking pretty damn good.
---
Dunno if you found my text, I left you a bit of feedback in the Beta's section.
Tue, 22 Jan 2013, 01:46
Dabz
Yeah, gots ya text Steve matey, thank you for that!

Its not gonna be an all singing and dancing editor like the windows and osx one, lean and mean, because i want this to run this as fast as possible on the Pi, so, make it project based, get it building, happy days!

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Sun, 27 Jan 2013, 12:30
Dabz
And... we finally have syntax highlighting...

dl.dropbox.com/u/3603620/Phew.png

Funny thing that, even though it doesnt look much, it's took me days to figure it all out.

When your programming in Linux using Vala and Gtk+, you realize there's very little information kicking around on how to do stuff, the gnome website is an absolute shambles... Links to nowhere, slow loading times of pages and when you look at the vala specific stuff, its very very bare... I thought about maybe getting a Vala book on my kindle as a reference... Looked... Sod all!!! Grrrrrrr

I'm amazed I've got this far without just closing the lot down and saying sod it, but, that wouldnt be fun... It's managing to grab me in such a way that the more it pisses me off, the more I want to get it by the scruff of the neck and shake it until it works!

Programming, its a funny thing really!

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Tue, 29 Jan 2013, 12:15
Dabz
Joy... Joy... And... JOY!!!

Ran into a problem lastnight, basically, with the little source view thing, I wanted to pick up a keyboard event, didnt think is was nothing major, an event is and event, connect a callback function to the source view, the user types, the event fires and my callback picks it up, take a nosey at the character typed or get the position of the cursor... Simple?

Erm... Nope!

Now, it doesnt help I dont know the ins and outs of this Vala programming language, considering I've been programming in the bugger for 5mins, but I never ever imagined doing such a thing would literally cost me an entire night, never mind 6am->720am this morning before work and from 4pm->Now!

Basically, I was having a look at the Gtk docs, they arent great, but, I've managed to churn through them so far... So, I have a source view, called... Amazingly... "source_view", and a callback function called "onKeyPress", so, with that, I embarked on trying to plug in that callback to the source view whatsit.

Waded through the docs and Google and was brought to the attention of a little thing called signals or something, so, after a few no compileys and generic errors... I managed to get something like this:-

Signal.connect(this.newView.source_view,"key_press_event",this.onKeyPress,this);


private void onKeyPress()
{
print("Keypress");
}


Which... Threw some sort of delegate [no idea] error... It was a different error then previously, so, further investigation required... Tinkered for a bit and managed to get it building using:-

Signal.connect(this.newView.source_view,"key_press_event",(GLib.Callback)this.onKeyPress,this);

Wahey I thought, I then tried to get the position of the cursor in the source view, using something like this in my callback:-

print((string)this.newView.source_view.buffer.cursor_position);

Ran... Seg fault, it down tools on a keypress... Bah!!!

Thought to myself, maybe it's seg faulting because it cannot see my source_view control thingy, so, spent ages trying to rejig my callback to pass the source of the key press, doing along the lines of:-

private bool onKeyPress(SourceView source)

Nope... Nowt... Seg fault FTW!!!

So, I moved on to trying a different approach, maybe I'm not passing matching parameters through to my callback:-

private void onKeyPress(Gdk.Event event)
private void onKeyPress(GtkWidget source)
private void onKeyPress(Widget source, Gdk.EventKey key)

Not a ruddy thing, baring, thats three from about 3 million...

Endless Google pages later... I came up with this:-

this.newView.source_view.key_press_event.connect(onKeyPress);

Though, the backend of that line (After this.source_view) must be internet hide and seek champion of all eternity, took me sodding ages to find it... But, it still wouldnt build, though, instead of seg faulting, I was getting a "cannot convert from something to another" error... So I must be close... Got to be close...

Roll on an hour of sheer graft and determination, and ever so close to saying "f*** it"... I will now present to you the line that magically fixes it all, and lets me access my source_view through the callback without seg faulting... Are you ready... Here she is:-

this.newView.source_view.key_press_event.connect(() => {this.onKeyPress();return(false);});


Check that tw*t out!!! \o/

All that... all that, and that single line of code right there does the biz... I really really really need to have a good read through the docs a bit more!

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Tue, 29 Jan 2013, 13:28
Jayenkai
Aaah, you're coding exactly like me!!
Google is a lazy coder's best friend! If I didn't have that, I might actually have to RTFM for a change.

It's great when something finally works! Well done!!

-=-=-
''Load, Next List!''
Wed, 30 Jan 2013, 00:22
Dabz
lol, well, I'd love to buy a book on the subject, I really would, at the minute I'm mostly relying on Python snippets and scouring dreaded mailing lists (Why Gnome dont just set up a Vala forum I dont know)

The little "huff" with this is that, it's catching the event before it plonks the character in the source view, so, if you have a blank page, and hit a key, lets just say an "x", it's not until you hit another key that you can pick up that that character was an "x"

Not ideal, but, funnily enough, this is how AvalonEdit worked, so, I can wangle to suit, takes a little bit more wangling, but, now, I'm expecting nothing less!

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Wed, 30 Jan 2013, 03:42
Jayenkai
Is there perhaps a none-event that you could use to trigger it, like maybe a simple timer that's constantly triggering things?

-=-=-
''Load, Next List!''
Wed, 30 Jan 2013, 12:30
Dabz
I dont really like timers for doing stuff like that, seems a waste really, think I'll just have to dig a little more, I mean, surely if they had some common sense, they would do a "before" and "after" of the press events, like, pick up the keyboard event before placing the character on the source view, then, one after.

There is "key_release" delegate (Posh as out me now after a bit of reading) I can use, but the problem with that is that obviously, you can hold the key down forever and it will chuck characters at the source view and I'll only know about it as soon as they let go!

Overall though, if I cannot get over it, I'll get under it, and if that fails, I'll smash straight through the git!

Dabz



-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Wed, 30 Jan 2013, 13:17
Dabz


Does the trick, not very pretty mind I dont think, but, seems to do as I ask (Using "key_release").

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Wed, 30 Jan 2013, 17:11
Afr0
Aaah, you're coding exactly like me!!
Google is a lazy coder's best friend! If I didn't have that, I might actually have to RTFM for a change.


I use Google all the time, and I don't code half as bad as you. And unless you're referring to using it for searching the Monkey forums, I don't know what you mean, cos I'm struggling to come up with decent results for doing anything in Monkey.

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!
Thu, 31 Jan 2013, 00:42
steve_ancell
Google is my homepage so that kind'a says it all.

I can't be coding much over the next few days though due to my room being mostly packed away coz I have engineers comming today to update the central heating system.
Thu, 31 Jan 2013, 15:31
Dabz
Me ickle source view thing is coming along, got it auto-casing on keywords and what not... Though, it currently has an annoying habit of doing it in strings... Tomorrows fixy!

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Thu, 31 Jan 2013, 16:51
Jayenkai
Yeay!!! Progress!!
Fri, 01 Feb 2013, 03:58
steve_ancell
I will get back to testing stuff within the next few days Mike, I'm still having loads of problems and stuff going on my end.
Fri, 01 Feb 2013, 09:36
Dabz

I will get back to testing stuff within the next few days Mike, I'm still having loads of problems and stuff going on my end


Hey, no problemo Steve me auld fruit... You get yourself all fine and dandy before anything else matey!

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Fri, 01 Feb 2013, 10:26
Dabz

Tomorrows fixy!


Done! \o/

What next... *Checks his imagery design document*

Oh, it says make a cuppa.... Champion! Woot

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Sat, 02 Feb 2013, 02:14
Dabz
Well, got auto casing recognizing if it's it strings or comments, so, it formats or not!



Yippieeee

Hey, this Linux dev lark is a breeze! *Swings eyes left to right in a loop*

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Sat, 02 Feb 2013, 02:21
Jayenkai
\o/yeay\o/
Sat, 02 Feb 2013, 02:30
rockford
Nice
Sat, 02 Feb 2013, 02:44
Dabz
Thanks fella's!!!

Gonna work on a bit of the GUI now, which is obviously the meat of any application, but, can only be comparable to watching the omnibus edition of Eastenders after finding a jackpot winning lottery ticket down the side of the couch which expired 181 days ago!

Boring week ahead from me in a coding sense*!

Dabz

*Hope I can keep this itch I've got in the last few days away to start banging out a game. lol



-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit