Silverfrost Forums

Welcome to our forums

\"Dynamic\" help for controls

25 Sep 2020 3:27 #26395

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.

	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 
26 Sep 2020 6:47 #26400

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.

26 Sep 2020 5:32 #26404

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!

15 Oct 2020 7:43 #26474

I have already added a new function in response to Bill's enquiry. I will provide details when I have them to hand.

16 Oct 2020 3:36 #26475

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)

18 Oct 2020 5:43 #26477

Thanks, Paul! I'll give this a shot.

20 Oct 2020 3:49 #26493

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

3 Aug 2023 2:55 #30493

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.

	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

3 Aug 2023 3:42 #30494

Bill

Is it 32 bits or 64 bits and which version of the DLL are you using?

3 Aug 2023 4:07 #30495

32 bit

Latest DLL's 6/28/2023

4 Aug 2023 7:30 #30496

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...

   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
4 Aug 2023 2:01 #30497

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

30 Oct 2023 3:37 #30678

The failure concerning set_tooltip_text@ has now been fixed.

The fix may not be in time for the next full release.

1 Nov 2023 2:41 #30680

Paul, thanks for taking care of this, and I understand about the next version, and not making it.

I'll look for it on one of the subsequent updates (?).

Bill

Please login to reply.