soccer jersey forums.silverfrost.com :: View topic - Birth defect of Clearwin
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Birth defect of Clearwin

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2866
Location: South Pole, Antarctica

PostPosted: Sun Sep 22, 2024 2:16 am    Post subject: Birth defect of Clearwin Reply with quote

There exist few design problems of Clearwin annoying from its start. Here is one of them:

Sometimes not human readable numbers.

Any chance to fix these unbearable F-formatted 12345678546665456 numbers and make them human readable in E format like 1.23456E+18 ?

Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8017
Location: Salford, UK

PostPosted: Sun Sep 22, 2024 6:26 am    Post subject: Reply with quote

See for example item 421 in cwplus.enh.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 711
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Sun Sep 22, 2024 4:32 pm    Post subject: Reply with quote

Code:
use clrwin
real*8 :: a = 12345678546665456.d0
i = winio@('a = %18`rf%nl&',a)
i = winio@('a = %12`rf%nl&',a)
i = winio@('a = %6`rf%nl',  a)
end
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2866
Location: South Pole, Antarctica

PostPosted: Mon Sep 23, 2024 7:14 am    Post subject: Reply with quote

Cool, that good upgrade. The only problem i am getting an error

Code:
%rf[fmt] requires %co[check_on_focus_loss]


To demonstrate it i tool Ken's example and modified it according to 421 enh

Code:
use clrwin
real*8 :: a = 12345678546665456.d0
i = winio@('a = %18rf[fmt=0.4e]%nl&',a)
i = winio@('a = %12rf[fmt=0.4e]%nl&',a)
i = winio@('a = %6rf[fmt=0.4e]%nl',  a)
end   
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 711
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Mon Sep 23, 2024 2:15 pm    Post subject: Reply with quote

Dan, I don't think that's unreasonable, since the value may be changed by the user and the displayed value needs to "reformatted".
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2866
Location: South Pole, Antarctica

PostPosted: Tue Sep 24, 2024 6:05 am    Post subject: Reply with quote

Convince me why controlling focus loss it is obligatory and why i will die without it. Typically i never use focus monitor. Before when i used it it only produced me troubles and in early times of Clearwin crashes

Also I see the length of control changes. In my example above all of them initially at 18, 12 and 6 character length became at the end of the same length. When i wrote

i = winio@('a = %18rf[fmt=0.4e]%nl&',a)

declaring it 18 characters long that was done for the purpose of formatting of GUI. Otherwise the controls will be jumping in size with changing declarations in the E format ruining GUI alignment. That would be permissible if i declared the %RF control too short for the E format to be able to write the number correctly, then i'd agree the length could be modified by the code (because generating an error to crash GUI is unacceptable)


Last edited by DanRRight on Tue Sep 24, 2024 8:48 am; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8017
Location: Salford, UK

PostPosted: Tue Sep 24, 2024 6:43 am    Post subject: Reply with quote

In general when a user types in a fp number it will contain digits, possible full stop, signs and E or e. Only when they have finished can ClearWin+ read and then present the number in the requested format.

The %co option effectly says "read the number when the user changes to a different control".

Maybe ClearWin+ could do "better" in cases where E and e are not permitted but otherwise to read and present as the number is typed character by character seems too much.

But if the Clearwin+ programmer knows exactly what they want then they can use a callback function to filter the input character by character.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2866
Location: South Pole, Antarctica

PostPosted: Tue Sep 24, 2024 8:50 am    Post subject: Reply with quote

Can you guys rewrite complaining demo code above to show how it was intended to work by design? Potential advantages of this approach (or unavoidable obstacles) kind of do not cross my quick view. I do not understand why you like it.
May be it is not that bad as i understood how it works. I have 100000 %RF used mostly both for reading and writing simultaneously and adding too much more to this operation would be way too cumbersomish. Clearwin was good because it was comparable and even surpassing in simplicity and convenience to plain Fortran WRITE(*,*) var
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8017
Location: Salford, UK

PostPosted: Sat Sep 28, 2024 10:57 am    Post subject: Reply with quote

Code:
program main
real*8 a,b,c
a = 0.0d0
b = 0.0d0
c = 0.0d0
iw = winio@("%co[check_on_focus_loss]&")
iw = winio@("%nlA: %rf[fmt=7.2g]&", a)
iw = winio@("%nlB: %rf[fmt=7.2g]&", b)
iw = winio@("%nlC: %rf[fmt=7.2g]&", c)
iw = winio@("%nl%^bt[Compute]","continue")
end program


The formats are applied when changing from one input box to another and when clicking on the button and when switching to a different application.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2866
Location: South Pole, Antarctica

PostPosted: Sun Sep 29, 2024 7:18 pm    Post subject: Reply with quote

This is exactly what was needed!
Thanks Paul

Was it well advertised in Silverfrost own channels? I do not have Help for FTN95 temporally, it does not work by some reason in WINE (very old version probably) under Linux and can not see visual examples like this below. KBase would be good place i think instead of digging deep into Clearwin..enh



And it correctly makes fields sizes too. Adding one %CO per file (not per each %RF as i initially thought) would be not as cumbersome (if Clearwin will remind about $CO was missing Would be totally awesome) The source was this
Code:
program main
real*8 a,b,c
a = 20.22444120d3
b = 20.22444120d5
c = 20.22444120d7
iw = winio@("%co[check_on_focus_loss]&")
iw = winio@("%nlA: %8rf[fmt=8.4g]&", a)
iw = winio@("%nlB: %12rf[fmt=8.4g]&", b)
iw = winio@("%nlC: %15rf[fmt=8.4g]&", c)
iw = winio@("%nl%^bt[Compute]","continue")
end program
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group