Picture clauses

This forum is meant for questions and discussions about the X# language and tools
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Picture clauses

Post by FFF »

Please bear with me, but in all these years i never needed it, so i'm blank :whistle:
Given a value in table like "JJD1405829178751"

Displayed in a SLE i'd like to see JJD 14 05 829 178 751", possibly edit this and write it back in the condensed form.

I "thought", that's what picture clauses are for, so added "AAA 99 999 999 999" - but the blanks eat the digits which "use" their place. OK, there's "OVERWRITENEVER", but this seems to be the opposite way...

Obviously i could write ACC/ASS to handle this, but i'd like to understand where i err ;)

TIA
Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
Chris
Posts: 4905
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Picture clauses

Post by Chris »

Hi Karl,

Yeah, that should work, I just checked and it is looking good. But apparently you need to save the value in the dbf including the spaces and assign it back to the SLE this way, too. I checked also VO, it has the same behavior.

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Picture clauses

Post by FFF »

Chris,
thx for responding. Duh, don't like to mix datavalue and "view" - the formatting is only a reading help.
But re-reading VO-Help, i'd think that @R AAA 99 99 999 999 999 should work?
"If you use the @R picture function, these characters are inserted between characters of the display value, and are automatically removed when the display value is reassigned to <idVar>; otherwise, they overwrite the corresponding characters of the display value and also affect the value assigned to <idVar>."
?

Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Picture clauses

Post by Karl-Heinz »

Hi Karl,

created with XIDE a FieldSpec and the output is:

? fsTest2{}:Transform ( "JJD1405829178751" )

"JJD 14 05 829 178 751"

Code: Select all

CLASS FsTest2 INHERIT FieldSpec


// User code starts here (DO NOT remove this line)  ##USER##
CONSTRUCTOR()
    LOCAL   cPict                   AS STRING

    SUPER( HyperLabel{#FsTest2, "", "", "" },  "C", 16, 0 )
    cPict       := "@R !!! 99 99 999 999 999"
    IF SLen(cPict) > 0
        SELF:Picture := cPict
    ENDIF

    RETURN

END CLASS
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Picture clauses

Post by FFF »

Hi Karl-Heinz,
thx for that.
Found it: had an assign in place, which basically does "osle:Textvalue := cVal"
Removing the magic "Text", so: osle:Value := cVal the clause get's respected, with fieldspec as with a "direct" picture!
Strange, as the "Textvalue" help says: "Note that the string is formatted according to the picture clause held in the field specification of the edit field; in turn, edit fields linked to a data server inherit the field specification — and hence picture — from the field of the server"
My sle is NOT directly bound to a server, so i wonder.

Anyway, happy to relieve my old eyes...

Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
Chris
Posts: 4905
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Picture clauses

Post by Chris »

Hi Karl,

I did not check this in particular, but in general, if the contents of the VO help file were always (or at least in more than 90% of the times) accurate, then everybody's job would had been a lot easier :).

When writing or fixing the runtime functions, we always need to first read the VO documentation, then test the behavior of VO to check how much accurate the documentation is (or how much VO is working as documented) and then implement the feature/or fix the existing one always taking into account the inconsistencies we definitely found in the previous step :)

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Picture clauses

Post by Karl-Heinz »

Hi Chris,

there are differences in the Transform() func and the Fieldspec:Transform() Method behaviour. But that´s no X# problem because already VO does it differently. So X# is 100% compatible with VO ;-) e.g. the formatted output of a german IBAN like "DE12345678901234567890" must be "DE12 3456 7890 1234 5678 90". This is possible with a Fieldspec, but not with the Transform() function.

Code: Select all


CLASS FsTest2 INHERIT FieldSpec


// User code starts here (DO NOT remove this line)  ##USER##
CONSTRUCTOR()
    LOCAL   cPict                   AS STRING

    SUPER( HyperLabel{#FsTest2, "", "", "" },  "C", 16, 0 )
    cPict       := "@R !!! 99 99 999 999 999"
    IF SLen(cPict) > 0
        SELF:Picture := cPict
    ENDIF

    RETURN

END CLASS


CLASS fs_C_IBAN INHERIT FieldSpec


// User code starts here (DO NOT remove this line)  ##USER##
CONSTRUCTOR()
    LOCAL   cPict                   AS STRING

    SUPER( HyperLabel{#fs_C_IBAN, "", "", "" },  "C", 22, 0 )
    cPict       := "@R !!99 9999 9999 9999 9999 99"
    IF SLen(cPict) > 0
        SELF:Picture := cPict
    ENDIF

    RETURN

END CLASS


? fs_C_IBAN{}:Transform ( "DE12345678901234567890" )
? Transform ( "@R !!99 9999 9999 9999 9999 99" , "DE12345678901234567890" )

similar behaves Karls "JJD1405829178751" string 

? fsTest{}:Transform ( "JJD1405829178751" ) 
? Transform ("@R !!! 99 99 999 999 999"   ,"JJD1405829178751" ) 


BTW. What happened with the forum software ? The new text formatting and the new forum coloring / layout is cruel !!!

regards
Karl-Heinz
User avatar
robert
Posts: 4519
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Picture clauses

Post by robert »

Karl,
BTW. What happened with the forum software ? The new text formatting and the new forum coloring / layout is cruel !!!
We have a new template.
So you don't like it ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4905
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Picture clauses

Post by Chris »

Robert,

I think I also see the problem Karl-Heinz talks about, when you type a post and reach end of line, the text does not wrap automatically to the next line (as before), instead you get the text scrolled to the right for 10 characters or so and then it does warp to the next line as you keep typing. It is indeed a bit clumpy and happens at least with Firefox. Ah, just noticed it happens only for the first line of text, next lines warp automatically correctly.

Apart from this glitch, I personally like the new layout.

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Picture clauses

Post by Karl-Heinz »

> We have a new template.
> So you don't like it ?

Hi Robert,

The TextBox to type in a message has 7 lines only and the slightly larger preview ( 11 lines ) doesn´t wrap the text but cuts it instead. So it´s hard to keep an overwiew. At least the colored "Facebook" etc. line of buttons i saw the very first time are no longer there and the green background appearance has also been reduced. To arrange the login sles in one line doesn´t look good too.

regards
Karl-Heinz
Post Reply