These are chat archives for picoe/Eto.Parse

27th
Feb 2017
Felix Queißner
@MasterQ32
Feb 27 2017 16:31
hey
Curtis Wensley
@cwensley
Feb 27 2017 17:43
@MasterQ32: hi (;
Felix Queißner
@MasterQ32
Feb 27 2017 17:51
so you are the one who made Eto.Parse and Eto.Forms?
Curtis Wensley
@cwensley
Feb 27 2017 17:51
yup!
Felix Queißner
@MasterQ32
Feb 27 2017 17:51
first at all: nice work!
those two things were the stuff missing for my projects :smile:
but i have a question regarding eto parse EBNF grammars
Curtis Wensley
@cwensley
Feb 27 2017 17:52
thanks! I'm happy to hear you like them
sure, go ahead
Felix Queißner
@MasterQ32
Feb 27 2017 17:52
I've taken the ebnf found on the github readme and took this:
name := {? Terminals.LetterOrDigit ?};
for identifiers in my language
but i found out that it also matches the empty string
how can i prevent this?
Curtis Wensley
@cwensley
Feb 27 2017 17:55
in ebnf, you'd do ? Terminals.LetterOrDigit ?, {? Terminals.LetterOrDigit ?};
see the 'simple value' terminal in the sample
Felix Queißner
@MasterQ32
Feb 27 2017 17:56
i disabled the comma thingy, but that shouldn't influence this at all, right?
Curtis Wensley
@cwensley
Feb 27 2017 17:56
since { } means zero or more
no that shouldn't influence that, it's just a different syntax.
Felix Queißner
@MasterQ32
Feb 27 2017 17:57
nice, thank you!
also, have you seen my pull request on eto forms?
i saw that the build didn't pass for pcl (what is this?)
Curtis Wensley
@cwensley
Feb 27 2017 18:02
Eto.dll is compiled using PCL 259 profile. It doesn't include the TypeConverter api's so it won't compile
Are you compiling Eto.dll some other way?
Felix Queißner
@MasterQ32
Feb 27 2017 18:03
i've used the build without pcl as it didn't compile at all on my machine (MonoDevelop,ArchLinux, Mono 4.6.1)
can you tell me more about the PCL 259 profile? what is it exactly?
Curtis Wensley
@cwensley
Feb 27 2017 18:05
There is no non-PCL build anymore.. it looks like you started from an old branch which is also a little odd.. You need to branch from develop.
PCL stands for "Portable Class Library". It allows the .dll to be used on many different platforms, e.g. Xamarin Mac/Android/etc, .NET Core, UWP, etc.
Felix Queißner
@MasterQ32
Feb 27 2017 18:06
i've branched from master
ah okay
there should be some kind of support for TypeConverter or some other conversion facility as in WPF
but i think that's not news to you
Curtis Wensley
@cwensley
Feb 27 2017 18:07
PCL will be eventually replaced with .NET Standard, which does allow greater access to things like TypeConverter, but it's not finished.
Felix Queißner
@MasterQ32
Feb 27 2017 18:07
hmm
my current use case is the following:
i want to bind a OpenTK.Vector3 to a text box for visualization
it implements a TypeConverter
so either i must create a wrapper class or use some other conversion facility
Curtis Wensley
@cwensley
Feb 27 2017 18:09
You can use the binding's Convert() extension to do some of this.. and then wrap it in a custom extension so it'd be easy to reuse in your project.
Felix Queißner
@MasterQ32
Feb 27 2017 18:10
how does the convert work?
my current binding looks like this:
tbPosition.TextBinding.BindDataContext(nameof(Agent.Position));
Curtis Wensley
@cwensley
Feb 27 2017 18:10
Binding.Property((MyModel m) => m.MyProperty).Convert(v => v.ToString(), s => MySomething.FromString(s));
so you'd change it to: tbPosition.TextBinding.BindDataContext(Binding.Property(nameof(Agent.Position)).Convert(...))
and in the Convert() you can use the type converter to get/set the value
if you just want to display the value (not edit), then you just have to define the conversion to string.
Felix Queißner
@MasterQ32
Feb 27 2017 18:13
okay, i see that i can use an IValueConverter as well?
Curtis Wensley
@cwensley
Feb 27 2017 18:13
yup
Felix Queißner
@MasterQ32
Feb 27 2017 18:15
tbPosition.TextBinding.BindDataContext(Binding.Property<Vector3>(nameof(Agent.Position)).Convert<string>(new Vector3Converter()));
System.InvalidCastException: Object must implement IConvertible.
or did i do something wrong?
ah wait, my fault
nevermind
okay, another question: can i somehow run the application synchronous with another UI "thread"?
Curtis Wensley
@cwensley
Feb 27 2017 18:18
as a hint, this: Binding.Property<Vector3>(nameof(Agent.Position)) is sometimes easier to write like this, so the type is inferred: Binding.Property((Agent m) => m.Position)
Felix Queißner
@MasterQ32
Feb 27 2017 18:19
yeah, but most probably i will have more than one type bound to the datacontext :P
Curtis Wensley
@cwensley
Feb 27 2017 18:20
Not sure what you mean how to run it synchronous with another UI thread.. do you have multiple UI toolkits in use or something?
Felix Queißner
@MasterQ32
Feb 27 2017 18:20
similar
Curtis Wensley
@cwensley
Feb 27 2017 18:20
btw, might want to move this over to #picoe/Eto
Felix Queißner
@MasterQ32
Feb 27 2017 18:20
i have OpenTK and Eto.Forms
yeah, sure :D