soccer jersey forums.silverfrost.com :: View topic - "Dynamic" help for controls
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 

"Dynamic" help for controls
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Fri Sep 25, 2020 4:27 pm    Post subject: "Dynamic" help for controls Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Sat Sep 26, 2020 7:47 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Sat Sep 26, 2020 6:32 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Oct 15, 2020 8:43 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Fri Oct 16, 2020 4:36 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Sun Oct 18, 2020 6:43 pm    Post subject: Reply with quote

Thanks, Paul! I'll give this a shot.
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Tue Oct 20, 2020 4:49 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Thu Aug 03, 2023 3:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Aug 03, 2023 4:42 pm    Post subject: Reply with quote

Bill

Is it 32 bits or 64 bits and which version of the DLL are you using?
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Thu Aug 03, 2023 5:07 pm    Post subject: Reply with quote

32 bit

Latest DLL's 6/28/2023
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Fri Aug 04, 2023 8:30 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Fri Aug 04, 2023 3:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Mon Oct 30, 2023 4:37 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Wed Nov 01, 2023 3:41 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
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