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

 
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: 820
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: 6554
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: 820
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
John-Silver



Joined: 30 Jul 2013
Posts: 1450
Location: Aerospace Valley

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

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 ... Smile "
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 6554
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: 6554
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
John-Silver



Joined: 30 Jul 2013
Posts: 1450
Location: Aerospace Valley

PostPosted: Sun Oct 18, 2020 3:41 pm    Post subject: Reply with quote

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 ... Smile "
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 820
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: 820
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
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
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