 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
wahorger

Joined: 13 Oct 2014 Posts: 1153 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: 7765 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: 1153 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: 1520 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: 7765 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: 7765 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: 1520 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: 1153 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: 1153 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 |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1153 Location: Morrison, CO, USA
|
Posted: Thu Aug 03, 2023 3:55 pm Post subject: |
|
|
I believe something is "broken". This used to work, now doesn't. See test program below. The click of the radio button should change the help text associated with the button.
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
integer(7):: help_control
common/help_common/iw,help_phrase,help_control
help_phrase='This is a long help phrase'
iw=1
ijk=1
iw = winio@('%?`^rb[This is a button]@%ud%lc%2nl&',ijk,close_window,help_phrase,999,help_control)
iw = winio@("%th[ms_style] ",1)
end
integer function close_window()
use mswin
integer:: user_data,iw
character*32:: help_phrase
integer(7):: help_control
common/help_common/iw,help_phrase,help_control
user_data = clearwin_info@('USER_DATA')
help_phrase = 'New Phrase'
print *,user_data,help_control,help_phrase
call SET_TOOLTIP_TEXT@(help_control,help_phrase)
close_window = 1
return
end |
I had also tried "change_help_text@" just in case, but same result.
Bill |
|
Back to top |
|
 |
PaulLaidler Site Admin

Joined: 21 Feb 2005 Posts: 7765 Location: Salford, UK
|
Posted: Thu Aug 03, 2023 4:42 pm Post subject: |
|
|
Bill
Is it 32 bits or 64 bits and which version of the DLL are you using? |
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1153 Location: Morrison, CO, USA
|
Posted: Thu Aug 03, 2023 5:07 pm Post subject: |
|
|
32 bit
Latest DLL's 6/28/2023 |
|
Back to top |
|
 |
PaulLaidler Site Admin

Joined: 21 Feb 2005 Posts: 7765 Location: Salford, UK
|
Posted: Fri Aug 04, 2023 8:30 am Post subject: |
|
|
Bill
I have had a look at this. It does not work for me either. I don't recall if it ever worked in this form. I have a touch of "man flu" at the moment so that might be clouding my judgement.
Here is the cut-down that I am testing...
Code: | program main
integer::iw,winio@
integer,external::cb
integer(7)::help_control
common/help_common/help_control
iw = winio@("%th[ms_style]&",1)
iw = winio@('%?^bt[This is a button][This is a long help phrase]&',cb)
iw = winio@('%lc',help_control)
end program
integer function cb()
use clrwin
integer(7)::help_control
common/help_common/help_control
call set_tooltip_text@(help_control,'New Phrase')
cb = 2
end function |
|
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1153 Location: Morrison, CO, USA
|
Posted: Fri Aug 04, 2023 3:01 pm Post subject: |
|
|
Paul,
Get better! Getting sick in the summer is a doubly bad deal!
I believe this did work in the 2020 time frame of my reply post.
I only use this in one context (using it about 50+ times though), and while it is exceptionally useful to have, I can implement an alternate solution (i.e. clicking on an icon versus rolling over the control).
Which is to say, if it cannot be implemented, I have a way around it.
Get better first,
Bill |
|
Back to top |
|
 |
PaulLaidler Site Admin

Joined: 21 Feb 2005 Posts: 7765 Location: Salford, UK
|
Posted: Mon Oct 30, 2023 4:37 pm Post subject: |
|
|
The failure concerning set_tooltip_text@ has now been fixed.
The fix may not be in time for the next full release. |
|
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
|