View previous topic :: View next topic |
Author |
Message |
wahorger

Joined: 13 Oct 2014 Posts: 928 Location: Morrison, CO, USA
|
Posted: Fri Sep 25, 2020 4:27 pm Post subject: "Dynamic" help for controls |
|
|
I've been investigating using the "?" and "@" for help. I've run into a stumbling block. I know a way "around" the problem, but....
The issue is that the "@" does get the CURRENT data from the string provided when the winio@ is executed. Which is great. I'm using that. However, for a help string that needs to change contents dynamically when the user performs a specific action, a simple window_update@() for either the control or the string is ineffective. I have to redraw the whole window for the change to be recognized.
The code below illustrates this. Clicking on the rado button should force the displayed text (internally) to change, but the HELP when rolling over the control does not change.
I don't know if there is another facility that I am not aware of that would allow this to be dynamic.
Code: | winapp
program main
integer:: iw,winio@,ijk=1
integer,external:: close_window
character*260:: buffer='this is not quite a file name but might serve as an example'
character*32:: help_phrase
common/help_common/iw,help_phrase
read *,help_phrase
iw = winio@("%ac[Ctrl+C]&", "COPY")
iw = winio@("%cm[Copy]&", "COPY")
iw = winio@('%?`25re[]@%ff%nl&',buffer,help_phrase)
iw = winio@('%rd %?`^~rb[]@%ud%2nl&',iw,iw,ijk,close_window,help_phrase,999)
iw = winio@("%50.2cw[hscroll,vscroll]&", 10)
iw = winio@("%lw",ictrl)
do i = 1,100
write(10,*) "Line ", i
end do
end
integer function close_window()
use mswin
integer:: user_data,iw
character*32:: help_phrase
common/help_common/iw,help_phrase
user_data = clearwin_info@('USER_DATA')
!print *,user_data
help_phrase = 'New Phrase'
call window_update@(help_phrase)
call window_update@(iw)
close_window = 1
return
end |
|
|
Back to top |
|
 |
PaulLaidler Site Admin

Joined: 21 Feb 2005 Posts: 6762 Location: Salford, UK
|
Posted: Sat Sep 26, 2020 7:47 am Post subject: |
|
|
Bill
The help string in your code can't be updated. The "standard string" is static.
You could use %th[ms_style] and change the text by calling set_tooltip_text@.
Alternatively I could possibly provide a new function that does the same thing when %th is not used. |
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 928 Location: Morrison, CO, USA
|
Posted: Sat Sep 26, 2020 6:32 pm Post subject: |
|
|
Paul, thanks for the offer. I think what I will do is have a small icon that the user can click to display the information.
Having to add the code (and data) for %th linkage affects too many areas. That said, if I do need this for a smaller application, I will definitely keep it in mind! |
|
Back to top |
|
 |
John-Silver

Joined: 30 Jul 2013 Posts: 1475 Location: Aerospace Valley
|
Posted: Thu Oct 15, 2020 8:29 pm Post subject: |
|
|
Paul, I think your offer would be invaluable.
... for this and maybe other similar'static variable' uses whre they exist. _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " |
|
Back to top |
|
 |
PaulLaidler Site Admin

Joined: 21 Feb 2005 Posts: 6762 Location: Salford, UK
|
Posted: Thu Oct 15, 2020 8:43 pm Post subject: |
|
|
I have already added a new function in response to Bill's enquiry. I will provide details when I have them to hand. |
|
Back to top |
|
 |
PaulLaidler Site Admin

Joined: 21 Feb 2005 Posts: 6762 Location: Salford, UK
|
Posted: Fri Oct 16, 2020 4:36 pm Post subject: |
|
|
A new routine CHANGE_HELP_TEXT@ has been added. This is like SET_TOOLTIP_TEXT@ but is for help strings that are not ms_style tooltips. These occur when %th is used without [ms_style] or an option that implies [ms_style]. They also occur when a control is defined using the ? modifier (e.g. %?bt[OK]) and when neither %th nor %bh is present.
SUBROUTINE CHANGE_HELP_TEXT@(hWnd, Text)
INTEGER(7) hWnd
CHARACTER*(*) Text
This is available in the latest DLLs but in the absence of the required new cleawwin.ins and module you will need the interface...
C_EXTERNAL CHANGE_HELP_TEXT@ '__change_help_text'(VAL7,INSTRING) |
|
Back to top |
|
 |
John-Silver

Joined: 30 Jul 2013 Posts: 1475 Location: Aerospace Valley
|
Posted: Sun Oct 18, 2020 3:41 pm Post subject: |
|
|
Thanks Paul
Where you wrote:
Quote: | This is available in the latest DLLs |
The 'latest dlls' on post:
http://forums.silverfrost.com/viewtopic.php?t=4245
appear to date from 12 Oct 2020
I assume those contain the revision to which you refer (to the dlls only obviously). _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " |
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 928 Location: Morrison, CO, USA
|
Posted: Sun Oct 18, 2020 6:43 pm Post subject: |
|
|
Thanks, Paul! I'll give this a shot. |
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 928 Location: Morrison, CO, USA
|
Posted: Tue Oct 20, 2020 4:49 am Post subject: |
|
|
It does work! Very nice to have this.
One thing to note: If the new help text exceeds the longest help text present when the window was originally built, this new help text will be truncated.
I got around that by appending CHAR(160) to each element of the original help text character array (most of which is blank when the window is built) thereby preserving the character length "buffer size".
Thanks a bunch Paul. This will really help my users.
Bill |
|
Back to top |
|
 |
|