|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1227 Location: Morrison, CO, USA
|
Posted: Mon Aug 08, 2022 10:00 pm Post subject: BLANK_CONTROL@?? |
|
|
I know there is a way to un-blank a control [CALL UNBLANK_control(hwnd)], but is there a way to blank a control similar to [initially_blank] that can be applied to %rd, %rf,...?
I allow my users to clear a table of numbers. It would be helpful to have it blanked as well, just like it originally presented.
There may be other ways of doing this, like using a child window, closing the original window and re-drawing it and placing it in the active window.
I do not want to use a text control and handle the user input in real-time if I can avoid it.
Bill |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Tue Aug 09, 2022 7:14 am Post subject: |
|
|
Is this what you have in mind?...
Code: | winapp
module mymod
use mswin
implicit none
integer(7) hwnd
integer n
contains
integer function clear()
integer(7) h
h = SendMessage(hwnd, WM_SETTEXT, 0, 0)
h = SetFocus(hwnd)
!n = 0 !perhaps
!clear = 1
clear = 2
end function
end module
program main
use mymod
implicit none
integer i
n = 0
i = winio@('%cn%rd&',n)
i = winio@('%lc&',hwnd)
i = winio@('%ff%cn%`rd&',n)
i = winio@('%ff%nl%cn&')
i = winio@('%^bn[Clear]', clear)
end program main |
|
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Tue Aug 09, 2022 10:57 am Post subject: |
|
|
Bill,
I asked exactly the same question some years ago. Paul's reply was far more tentative at the time. I think that the speed of his response this time reflects the fact that he already answered the question.
Personally, I think that a ClearWin+ function as part of the library is far more useful than all the Fortran 2003/2008 stuff we've got lately, and would be infinitely comprehensible than programming with SendMessage and SetFocus - and more to the point, would be in the spirit of ClearWin+. In any case, wouldn't it be useful to have the solution, whatever it is, in the help file?
There is another way, and that is to close the dialog in its entirety, then to re-open it with the control blanked. It's a solution I developed in 2004/2005, and at the time, it caused a noticeable 'blink'. There is a function FREEZE_WINDOW_CONTENTS@ that puts a temporary copy of the window over the top with a matching UNFREEZE_WINDOW_CONTENTS@ so that with judicious use it might be possible to hide the 'blink'. I experimented at length, decided it was a load of overcomplex rubbish, and asked the question on the forum!
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Tue Aug 09, 2022 1:26 pm Post subject: |
|
|
If the sample above is what is required then I can provide a ClearWin+ routine that does the same thing. It will only work for controls like %rd/%rf/%rs/%re. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Tue Aug 09, 2022 1:36 pm Post subject: |
|
|
Paul,
I think that would be brilliant. The point being that it would then be obvious when reading the Fortran what is being done!
On what is perhaps a related matter (but may not be) what about those input boxes that have text in them, usually in blue, that disappears when you start entering text or numbers? Anyone know how that's done? (For example 'Password' and then you type over it with your password).
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Tue Aug 09, 2022 3:27 pm Post subject: |
|
|
I will add a routine SET_CONTROL_TEXT@(hwnd, text, setFocus) where text can be a blank string and setFocus will be a LOGICAL that will set the focus to the control when .TRUE.
There is an existing routine SET_CONTROL_TEXT_COLOUR@ which in theory could be used to provide grey text for a prompt and to switch back to black text as soon as the user starts typing.
So how can the programmer anticipate that the user has started typing? The answer is via the EN_UPDATE notification code provided by the Windows API.
It might be possible to provide a ClearWin+ routine or perhaps a %co option that does everything for you. But how often would you want to set the greyed prompt, once only at the outset? |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Tue Aug 09, 2022 5:29 pm Post subject: |
|
|
Paul,
You are likely to be far more knowledgeable than I on the finer points. I certainly hadn't thought it through, just that it was something that I'd seen and thought it was a good idea, because it hints to the new user what is expected of them.
Whatever you produce will certainly be appreciated by the community.
Eddie |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1227 Location: Morrison, CO, USA
|
Posted: Tue Aug 09, 2022 9:07 pm Post subject: |
|
|
Paul, this is exactly what I was looking for!
I played with it in my code, and it works perfectly. The return value of "clear" is important, I discovered! I need this only in a few places; it really, really helps keep the windows/dialogs clean!
For me (at least) the restriction to those particular formats is perfectly fine.
Thanks! |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1227 Location: Morrison, CO, USA
|
Posted: Tue Aug 09, 2022 9:14 pm Post subject: |
|
|
Just an FYI on the blue text. I have also seen it in simple grey. Some people cannot see light shades of blue, so grey would be better as the default.
My experience with this has been websites primarily, but also some Windows/IOS/LINUX programs. If the text is blank, then the blue/greyed text disappears. If the user were to delete all their entered text, the blue/greyed text *usually* comes back. Not always, for every website.
My accounting program does this for its tables; the cell has a greyed explanation of what is expected, and if you remove all your entered text, the "prompt" comes back.
I could use either method, though given my user base, the one where the blue/greyed text reappears would be more beneficial.
Bill |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Wed Aug 10, 2022 1:18 pm Post subject: |
|
|
I have added a new routine SET_CONTROL_TEXT@ that can be used either to blank out a control or to provide an initial prompt (for %rd, %rf or %rs) at startup and when the end user makes the control blank by deleting all the characters.
Here is a sample that illustrates creating a prompt...
Code: | winapp
module mymod
implicit none
integer(7) hwnd
integer n
! real(2) n
! character(32) n
contains
integer function start()
C_EXTERNAL set_control_text@ '__set_control_text'(VAL7,INSTRING,VAL3,VAL3)
call set_control_text@(hwnd, "Prompted", 255, 1)
start = 2
end function
end module
program main
use mymod
implicit none
integer i
n = 0 !""
i = winio@('%cn%rd&',n)
! i = winio@('%cn%rf&',n)
! i = winio@('%cn%rs&',n)
i = winio@('%lc&',hwnd)
i = winio@('%sc', start)
end program main
|
The second argument in SET_CONTROL_TEXT@ is set to an empty string in order to blank the control or to the required prompt text.
The third argument provides the text colour for the prompt (the colour red in this case).
The last argument is set to a non-zero integer in order to set the focus to this control. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Thu Aug 11, 2022 9:37 am Post subject: |
|
|
A new format code %pr has been added for the next release of the DLLs.
This provides a simpler way to get a prompt of the kind described above.
It is illustrated in the following sample where the text "Prompted" appears in grey text RGB@(100,100,100) both initially and when the end user deletes all the characters in the integer %rd control.
Code: | winapp
program main
implicit none
integer i,n
n = 0
i = winio@('%cn%rd&',n)
i = winio@('%pr','Prompted', RGB@(160,160,160))
end program main |
|
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2877 Location: South Pole, Antarctica
|
Posted: Thu Aug 11, 2022 10:30 pm Post subject: |
|
|
Bill,
Out of topic question. Which multitab two panel editor you have recommended few years back when we discussed which editors is the best? I have one (Notetab) but need another good editor just to separate several independent multi-file projects |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1227 Location: Morrison, CO, USA
|
Posted: Fri Aug 12, 2022 4:17 pm Post subject: |
|
|
I use EditPad Pro (https://www.editpadpro.com/). They have both a free and a paid version (annual maintenance).
You can split the editor horizontal or vertical, or start a new copy for an existing edit (i.e. one file in a new instance of the editor, or a floating window). I use all these from time to time.
You can limit a text search to a single file (the current one), or search all the open files. I use the latter when I have a LOT of files for which I wish to make a global change (like a routine name or variable name).
What I like most of all is the color coding that is syntax dependent. There are a lot of options for various kinds of files, and one for FORTRAN. It isn't perfect. I find it useful as a visual aid when looking for issues. It also has a feature where it will look for matching parentheses (visually indicated, either the corresponding opening or closing). I find this extremely helpful especially for formulae.
I think the price is reasonable, and the support is very good. I have found problems (usually quite arcane), reported them, and a new version was released shortly thereafter. I use other products from this vendor as well (HELP file creator and a tool to generate signed setup to deploy my software to my users). |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Fri Aug 12, 2022 5:44 pm Post subject: |
|
|
Bill
I don't want to divert you from you favourite editor but you get all of this and much much more with Plato which is free. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2877 Location: South Pole, Antarctica
|
Posted: Fri Aug 12, 2022 6:18 pm Post subject: |
|
|
Bill,Thanks.
I downloader trial version and found it is very feature rich but hell anti-intuitive. I imagine that if you adjusted to it - it will be probably hard to quit it for the another editor. But it killed me with its difficulty to do things i anticipate. I literally fighted and failed on everything. Search is super versatile, it even makes summary of lines with the found items, but antiintuitive to the total extreme. Who the hell need the option "Find 100th next, Find 100s previous". Who counts to exactly 10 or 100, this is an insane absurd option. While obvious "Search All Files" is absent (!!!). And after crash or reboot (damn Windows self-updated at night without permission as usually) it lost all my files...
And most of all - as i said, i switched to it because the project has tons of files. But can this editor show all the tabs for the something like 100-200 files? If it can not stack the tabs all other editors do, it would be very hard to work on large projects without additional antiintuitive tricks like those you have mentioned because you can not find and change the files quickly.
Support is indeed fast. I have sent the question about tabs not stacking and already got the answer (something like - try to put the tabs vertically - which will not help, obviously). Will try to use it for a while, may be i will also like it at the end for some its unique other features at least. For example, you have mentioned before that it can not mess with Linux files inserting extra Windows characters.
Paul,
I even will not try Plato because afraid that my possible complaints will distract you and the whole community from your development of other new more important Fortran features
Last edited by DanRRight on Fri Aug 12, 2022 6:45 pm; edited 4 times in total |
|
Back to top |
|
|
|
|
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
|