Input different data types (integers or datetimes) in a textbox.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Input different data types (integers or datetimes) in a textbox.

gerard alis
I want know if exists some way or mechanism for input data in a widget of a specific type. For example a textbox with only numbers ( decimals or only integers ) or some mechanism of mask edit for fill a text in a textbox of "type" DateTime ??

I´m developing a grid widget and I need in each column define a type of data. With strings is easy but for another values i don´t know do it.

As always excuse me for my poor english, and regards.
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Input different data types (integers or datetimes) in a textbox.

Stéphane Ducasse
As far as I know, what you are looking for does not exist.
May be you should have a look at Magritte because it describes a lot of data type already
and there validation.

Stef

>
> I want know if exists some way or mechanism for input data in a widget of a
> specific type. For example a textbox with only numbers ( decimals or only
> integers ) or some mechanism of mask edit for fill a text in a textbox of
> "type" DateTime ??
>
> I´m developing a grid widget and I need in each column define a type of
> data. With strings is easy but for another values i don´t know do it.
>
> As always excuse me for my poor english, and regards.
> --
> View this message in context: http://n2.nabble.com/Input-different-data-types-integers-or-datetimes-in-a-textbox-tp4442293p4442293.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Input different data types (integers or datetimes) in a textbox.

Schwab,Wilhelm K
In addition to Stef's recommendation, the correct approach to this is to use value converters and a mixture of flags on the widgets (e.g. numeric-only) and closures for validation.  That way, the widgets "think" in text, and the ultimate model (or aspect thereof) can have whatever type is appropriate to the domain.

Bill


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Stéphane Ducasse
Sent: Friday, January 22, 2010 4:01 PM
To: [hidden email]
Subject: Re: [Pharo-project] Input different data types (integers or datetimes) in a textbox.

As far as I know, what you are looking for does not exist.
May be you should have a look at Magritte because it describes a lot of data type already and there validation.

Stef

>
> I want know if exists some way or mechanism for input data in a widget
> of a specific type. For example a textbox with only numbers ( decimals
> or only integers ) or some mechanism of mask edit for fill a text in a
> textbox of "type" DateTime ??
>
> I´m developing a grid widget and I need in each column define a type
> of data. With strings is easy but for another values i don´t know do it.
>
> As always excuse me for my poor english, and regards.
> --
> View this message in context:
> http://n2.nabble.com/Input-different-data-types-integers-or-datetimes-
> in-a-textbox-tp4442293p4442293.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Input different data types (integers or datetimes) in a textbox.

Gary Chambers-4
In reply to this post by gerard alis
Something like the following example could work, though there are a few
rough edges at present in terms of caret position and editing (I've only
used the treansform bit to change case of strings, for instance, which
behaves reasonably)...

(UITheme builder
newAutoAcceptTextEntryFor: ValueHolder new inspect
getText:  #contents setText: #contents: getEnabled: nil help: nil)
converter: ((ObjectTransformedStringConverter forClass: Integer)
transformBlock: [:s | s select: [:c | c isDigit]]);
openInWindow

Dates are a bit trickier since the class-side #readFrom: expects a
correct format or will error...

Regards, Gary.

On Fri, 2010-01-22 at 12:28 -0800, nullPointer wrote:

> I want know if exists some way or mechanism for input data in a widget of a
> specific type. For example a textbox with only numbers ( decimals or only
> integers ) or some mechanism of mask edit for fill a text in a textbox of
> "type" DateTime ??
>
> I´m developing a grid widget and I need in each column define a type of
> data. With strings is easy but for another values i don´t know do it.
>
> As always excuse me for my poor english, and regards.
> --
> View this message in context: http://n2.nabble.com/Input-different-data-types-integers-or-datetimes-in-a-textbox-tp4442293p4442293.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Input different data types (integers or datetimes) in a textbox.

gerard alis
That is perfect for the moment, many thanks. Magritte is too much complicated for me, my brain is limited and cannot understand it :(  

I have a textbox for work with strings and now a NumericEdit control for numbers; but now I´m trying use decimals, including in TransformBlock  -> [:s | s select: [:c | c isDigit or:[ c = '.' ]]] and Float like type,
but don´t works correctly.

Is possible implement that mechanism catching the keypress event and cancel the event if will be a incorrect format? Perhaps with Date is the best option.

Regards.
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Input different data types (integers or datetimes) in a textbox.

Gary Chambers-4
Some work to integrate checking of chars as typed, probably worth doing at
some point though.

For Floats it is likely best to make a specific converter class, folowing
the same protocol as ObjectStringConverter. That way there will be some
control over the representation (no exponents etc.).

Regards, Gary

----- Original Message -----
From: "nullPointer" <[hidden email]>
To: <[hidden email]>
Sent: Monday, January 25, 2010 4:53 PM
Subject: Re: [Pharo-project] Input different data types (integers or
datetimes) in a textbox.


>
> That is perfect for the moment, many thanks. Magritte is too much
> complicated
> for me, my brain is limited and cannot understand it :(
>
> I have a textbox for work with strings and now a NumericEdit control for
> numbers; but now I´m trying use decimals, including in TransformBlock  ->
> [:s | s select: [:c | c isDigit or:[ c = '.' ]]] and Float like type,
> but don´t works correctly.
>
> Is possible implement that mechanism catching the keypress event and
> cancel
> the event if will be a incorrect format? Perhaps with Date is the best
> option.
>
> Regards.
> --
> View this message in context:
> http://n2.nabble.com/Input-different-data-types-integers-or-datetimes-in-a-textbox-tp4442293p4455055.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Input different data types (integers or datetimes) in a textbox.

Stéphane Ducasse
In reply to this post by gerard alis

On Jan 25, 2010, at 5:53 PM, nullPointer wrote:

>
> That is perfect for the moment, many thanks. Magritte is too much complicated
> for me, my brain is limited and cannot understand it :(  

probably ;)

now in three sentences
        - you have object (descriptions) that describes others (domain)
        - you use descriptions to build programs that treat domain value with the perspective of descriptions (saving data, displaying data, validating data)
        so if a description says that a string is a date then you get readers, writer, validation of 6-jan-2009.... all belonging to one object: the dateDescription.

I have a textbox for work with strings and now a NumericEdit control for

>
> numbers; but now I´m trying use decimals, including in TransformBlock  ->
> [:s | s select: [:c | c isDigit or:[ c = '.' ]]] and Float like type,
> but don´t works correctly.
>
> Is possible implement that mechanism catching the keypress event and cancel
> the event if will be a incorrect format? Perhaps with Date is the best
> option.
>
> Regards.
> --
> View this message in context: http://n2.nabble.com/Input-different-data-types-integers-or-datetimes-in-a-textbox-tp4442293p4455055.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Input different data types (integers or datetimes) in a textbox.

Marcus Denker-4
In reply to this post by gerard alis

On Jan 25, 2010, at 5:53 PM, nullPointer wrote:

>
> That is perfect for the moment, many thanks. Magritte is too much complicated
> for me, my brain is limited and cannot understand it :(  

I think Ted Kaehler quoted (or even invented?) something along this lines:

        "It's hard to understand that nothing is hard to understand once you understand it".

And it's true.

        Marcus

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project