<< 04-July-2008 : hausbot on #boo at codehaus [download] [back] >>
 
 
time nick message

09:02

<dajo>

hi everybody

09:31

<ngn>

soon, eh

10:48

<[srx]>

hello

10:48

<Avish>

hi srx

10:48

<Avish>

how's it going?

10:54

<[srx]>

oh, I just having fun with boo, AutoCad etc :)

10:54

<Avish>

enjoy

10:56

<[srx]>

yeah, coffee break

11:15

<dajo>

wb avish :)

11:16

<dajo>

im looking for a way to create an imputmast automaticly from a class. has anybody a idea where i could finde something like that ?

11:18

<Avish>

to create a what now?

11:18

<Avish>

inputmask?

11:19

<dajo>

a dialog wich contains fiels for everyproperty of the class

11:19

<dajo>

the type of the field should depend on the type of the variable, so if the type is date i want to have a dateselector

11:19

<dajo>

if the type is string, i want a textbox,...

11:20

<dajo>

and i want to have a button [ok] to write all values back into the class

11:22

<Avish>

ooh. nice idea.

11:22

<Avish>

Visual Studio 2005 has something like it: if you make your class into a datasource (which is fairly easy) you can "drag" some of it fields onto a form and get input controls for them.

11:22

<dajo>

thnx. but i dont have a idea how to start :(

11:23

<dajo>

the problem is, the class is variable.

11:23

<dajo>

my idea is something like this:

11:23

<Avish>

maybe TypeDescriptor.GetProperties will help you. you give it a type and it gives you properties that type exposes.

11:24

<Avish>

in a way that allows you to read them and write them, given a specific instance of that type.

11:24

<Avish>

you should really look into databinding, that's what they do.

11:24

<dajo>

ill do

11:25

<dajo>

i know i can bind a field (in my gui) to a filed of the database, but can i bind a field of the databinding dynamicly to a propterty of a class ?

11:28

<dajo>

databinding is not _exactly_ what im looking for. it changes the value of the class in that moment, the value in the gui has changed. i want to submit the changes on a button-click.

11:43

<[srx]>

dajo, why not use button-click evet

11:43

<[srx]>

event

11:47

<dajo>

yea, that could work... i found something more. there 3 ways to 'sync' the data.

11:47

<dajo>

1. on the fly

11:47

<dajo>

2. manually

11:47

<dajo>

thats what i want

11:47

<dajo>

and 3. i dont remember. not so important :)

11:51

<Avish>

dajo: databinding allows you to bind to an object rather than a database or dataset.

11:51

<dajo>

yea, but i have to bind it too a class... im just playing around. well see how it'll work

11:52

<Avish>

if you want to submit on button click, a good approach would be to have your regular instance of the object, and another, "in-edit" instance cloned from it. you can then databind to the in-edit object, and when the user presses OK you will copy the in-edit object over the normal one.

11:52

<Avish>

If you're using VS2005, try "add a project datasource" and select "object datasource". that would allow you to bind to a class. play with it.

11:53

<Avish>

Also, I think it's possible to tell .NET databinding to only synchronize between the data and the controls manually, and not whenever a value changes. I'm not sure about that though.

11:54

<dajo>

im using vs-express 2005 and #develop

11:54

<Avish>

a different approach would be to write your own binding framework, where you could create "bindings" between data instances and input controls which you control programmatically.

11:54

<Avish>

You actually have at least two different problems:

11:54

<dajo>

thats what im trying to work on. depends on how much work it is. because its just a smaler problem.

11:54

<Avish>

1. synchronize between input controls and properties of a class programmatically.

11:54

<dajo>

wich ones ?

11:55

<Avish>

2. create "bound" input controls given a specific class.

11:55

<dajo>

the first is no problem. i sync on init and on ok_clicked

11:55

<Avish>

after you solve the first problem, the second one will be easier.

11:55

<Avish>

dajo: but you want that syncing to be automatic, you don't want to hand-code the syncing code for every control

11:56

<Avish>

so you want to create some notion of "binding" saying "this control is bound to that property, now when I say init copy the value from the property to the control, and when I say save copy it from the control back to the property".

11:56

<Avish>

databinding does that but you can also roll your own.

11:56

<dajo>

i have a list with the name of all values, and i can get the set-method via propertyinfo.

11:57

<dajo>

so i can walk through the list, get the method and wrrite the data back

11:57

<Avish>

how do you find a given property's control or vice-versa?

11:57

<dajo>

yea. thats exactly what i want to do

11:57

<dajo>

gettype().getProperties()

11:58

<Avish>

right. so a possible answer to that is to record the relationship between controls and properties in an external Binding class. Take a look at databinding's Binding class, you'll see what I mean.

11:58

<dajo>

each item i add to my gui is bound in a groupbox. the groubbox has a title. that title will be the name of the property

11:58

<dajo>

k

11:59

<Avish>

I guess you can do it that way, but it sounds like an unnecessary restriction.

11:59

<dajo>

maybe i could do it that way too. if i add the gui-element, i add the databinding too.

12:00

<Avish>

Anyway, to support different input controls, you might need different BindnigProviders or whatever: one that uses a textbox's Text property, another that uses a DateTimePicker's Value property, a third that would use a ComboBox's SelectedValue, etc.

12:00

<dajo>

yea...

12:00

<Avish>

Because you can't handle all input controls in the same way.

12:01

<Avish>

Now, databinding also does that too, since it allows you to bind a specific property on a specific class to a different property on an input control.

12:01

<dajo>

but i have a much more trivial problem right now :) what is the baseclass of all gui-elements

12:01

<Avish>

ah. that's easy: Control

12:01

<Avish>

except for ToolStripItems and such that don't inherit from Control

12:01

<dajo>

thnx

12:01

<Avish>

but there are many controls who are not input controls, such as groupbox, panel etc.

12:03

<dajo>

i know. but i just try to create a very early version, just to check if it coul dword the the way i want it to work

12:03

<Avish>

alright, have fun.

12:04

<dajo>

ill do... i hope it works

12:04

<dajo>

would be much less work for me, and much more fun

12:04

<dajo>

ill tell you later bout my expiriences

13:53

<dajo>

i got it :)

13:54

<dajo>

its in VB, but it works

14:00

<Avish>

hey, great!

14:00

<dajo>

it was easy.

14:00

<dajo>

i just just the flowlayoutpanel and the databindings

14:01

<dajo>

create a contol, add a binding and add the control to the flowlayoutoanel -> thats it

14:01

<dajo>

oops. the fist sentence is i just used :)

14:05

<Avish>

great, I'm happy for you

14:05

<Avish>

how did you figure which control to add for which property?

14:06

<dajo>

up to now im using a case statement, and propertyinfo.PropertyType

14:06

<dajo>

its still hard coded. but i want to do it on the fly next

14:27

<dajo>

waow... thats great. its even possible to do something like undo without much work

14:28

<dajo>

and i need just 69 lines of code....

14:53

<dajo>

i added dynamic typehandling now.

14:55

<dajo>

you have to call it with the class you want to visualize, and a enumaerate of pairs(tpye,(type,string)) where the first type is the type wich schould be handled, the second the control and the string represents the name of the property the value is assigned to

15:31

<dajo>

ok and now i convertetd it too boo...

15:31

<Avish>

:)

15:31

<Avish>

you didn't write it in Boo to begin with?

15:37

<dajo>

i started in VB beacuse it was easyer to handle the gui...

15:38

<dajo>

and i did not want to do so much work in the beginning, so i did not write a boo assembly i used in VB

15:41

<dajo>

so, im out for today.

15:41

<dajo>

CYa

16:36

<NullHead>

I'm trying to build banshee. It errors on boo. I'm running ubuntu 8.04 and I cannot figure out how to install boo :|

16:36

<NullHead>

any help?

17:11

<dork800>

hello everyone

17:17

<dork800>

may i ask a question for my boo setup process?

17:18

<dork800>

is anyone here please?

17:19

<dork800>

--!

17:23

<dork800>

hello

17:23

<dork800>

to Drone:may i ask a question for my boo setup process?

17:53

<NullHead>

is anyone here?

Drone v1.4 © 2002-2005 Uwyn RIFE powered