Silverfrost Forums

Welcome to our forums

Some %BH (bubble help) issue

14 Jun 2020 11:10 #25639

Hello,

I defined for my buttons bubble help strings using %BH command as follows:

...
CALL ENABLE_UTF8@(1)
...
... 
    b1_h='Textový súbor so 7-riadkovou hlavičkou a hodnotami'//char(10)//' X,Y,DX,DY v tvare nepravouholníkovej mriežky, '//char(10)//&
&'(hodnoty X,Y nie sú zoradené vzostupne)'
...
...

ans=winio@('%4nl%ta%bf%fn[Courier New]Zvoľ vstupný TXT súbor:%5ta%bc[yellow]%`^?bt[&Vybrať vstupný súbor]@%`bh&',&
           'FILE_OPENR[Zvoľ súbor]',subor3,sb_vstup3,b1_h,1)
...
...

Regardless of the fact that the function ENABLE_UTF8@(1) does not work correctly in conjunction with %BH (it does not display correctly some letters with wedge from slovakian alphabet and replaces them with the letter l, although outside %BH has no problems with these letters) I would like to know how to curb/remove an unwanted effect displayed in the picture below:

[ https://i.postimg.cc/Gm2z9hnk/Bubble-help.jpg ](https://postimages.org/)

So, the basic and most important question is: How to remove/delete the unesthethical (ugly) black area surrounding the text in the bubble?

Thanks in advance for some ideas/comments!

Martin

14 Jun 2020 11:16 #25640

%th[balloon] should be used in preference to %bh. With [balloon] you get tooltips that can be changed dynamically. They also can have titles and icons.

[balloon] and other options imply [ms_style] which is the basis for getting all the extra functionality.

14 Jun 2020 11:44 #25642

OK Paul, I will use the %TH[balloon] command and will inform about the outcome - thanks!

14 Jun 2020 7:07 #25650

Thanks Paul for your tip - it also works with %th with no option:

[ https://i.postimg.cc/nzPZ2HMN/th-OK.jpg ](https://postimages.org/)

With the option [balloon] it looks like follows: [ https://i.postimg.cc/MGXWgsNC/Balloon-TH.jpg ](https://postimages.org/)

However, some interesting remarks:

I have 4 buttons for which I originally used the %BH. I changed the %BH command on %TH command on one of them only and also the rest 3 buttons which still had %BH active, showed the help as on the changed one (already with %TH). Then, I changed all other %BH to %TH, compiling and linking was OK, but I got a run time error saying the following: [url=https://postimages.org/]https://i.postimg.cc/Bn1nY7FX/Run-Time-TH.jpg ](https://postimages.org/)

So, I changed the %bh to %th on one button only (all other buttons still have the %bh active) and everything is OK now, I can see the help over them as if all of them had %TH command (what is not true).

The question is: In case, when there are more then ONE button and there is need for bubble help, is it sufficient to use the %TH command only for ONE randomly selected button and the rest (in my case 3 buttons) must have the %BH command?

14 Jun 2020 7:34 #25651

Still one important information remark: I have 4 buttons, but after start of the program, only the 1st button (serving for defining of an input file) and the 4th button (serving to end the program) are active (the other two are inactive and became active only then, when the user selects an input file using the 1st button).

When using %TH command with NO option, I can see the bubble help on all buttons by positioning the cursor over them (regardless whether they are or they are not active).

When I use the %TH with option [balloon], the bubble help is displayed only on currently active buttons (the inactive - greyed out - buttons do not show the bubble help). The bubble help with option [balloon] is only then displayed on inactive buttons, when they become active!

14 Jun 2020 8:55 #25652
module exp_mod
use clrwin
implicit none
private ; public exp1
integer :: help_control = 1
integer :: b3_control = 1

contains

integer function exp1()
integer, save :: iw
character(len=100) :: help1 = 'This is the help for button 1'//char(10)//'This is some more help for button 1'
character(len=100) :: help2 = 'This is the help for button 2'//char(10)//'This is some more help for button 2'
character(len=100) :: help3 = 'This is the help for button 3'
iw = winio@('%th[balloon]&', help_control)
iw = winio@('%mn[Exit]&','exit')
iw = winio@('%mn[Tog_help]&',toggle_cb)
iw = winio@('%mn[Tog3]&', tog3_cb)
iw = winio@('%^?tt[One]@&',                cb1, help1)
iw = winio@('%^?tt[Two]@&',                cb2, help2)
iw = winio@('%~^?tt[Three]@&', b3_control, cb3, help3)
iw = winio@(' ')
exp1 = 2
end function exp1

integer function tog3_cb()
  if (b3_control .eq. 1) then
    b3_control = 0
  else
    b3_control = 1
  end if
  tog3_cb = 1
end function tog3_cb

integer function toggle_cb()
  print*, 'toggle'
  if (help_control .eq. 1) then
    help_control = 0
  else
    help_control = 1
  end if
  print*, help_control
  call window_update@(help_control)
  toggle_cb=1
end function toggle_cb

integer function cb1()
  print*, 'CB1' ; cb1 =1
end function cb1

integer function cb2()
  print*, 'CB2' ; cb2 =1
end function cb2

integer function cb3()
  print*, 'CB3' ; cb3 =1
end function cb3

end module exp_mod

program main
use exp_mod
implicit none
integer i
i = exp1()
end
15 Jun 2020 9:48 #25658

Thanks Ken!

Nevertheless, I am keen to get an answer to my question, since at the moment I am confused when using %TH.

Here is the code I have defining the bubble strings and their use with %TH and also (at the moment) with %BH:

...
...
call ENABLE_UTF8@(1)
b1_h='Textový súbor so 7-riadkovou hlavičkou a hodnotami'//char(10)//' X,Y,DX,DY v tvare nepravouholníkovej mriežky, '//char(10)//&
&'(hodnoty X,Y nie sú zoradené vzostupne)'
    b2_h='Výstupný súbor, do ktorého sa zapíšu hodnoty X,Y,DX,DY vo'//char(10)//' vzostupnom poradí doplnené hodnotami X,Y,&
& pre ktoré DX=0, DY=0,'//char(10)//'aby sa vytvorila pravouholníková mriežka bodov' 
    b3_h='Po zvolení vst. a výst. súboru sa kliknutím'//char(10)//'na tento gombík spustí konverzia údajov'
    b4_h='Ukončenie programu'
...
...

ans=winio@('%4nl%ta%bf%fn[Courier New]Zvoľ vstupný TXT súbor:%5ta%bc[yellow]%`^?bt[&Vybrať vstupný súbor]@%th[balloon]&',&
           'FILE_OPENR[Zvoľ súbor]',subor3,sb_vstup3,b1_h,1) ! NOTE: %TH is used for the first button
...
ans=winio@('%3nl%ta%bf%fn[Courier New]Zvoľ výstupný TXT súbor:%4ta%bc[yellow]%~^?bt[&Vy&brať výstupný súbor]@%bh&',&
           button_grey_control,'FILE_OPENW[Zvoľ súbor]',subor4,sb_vstup4,b2_h,1) ! NOTE - %BH used for the 2nd button!!!
...
...
 ans=winio@('%3nl%ta%bf%fn[Courier New]Spustenie konverzie údajov:%ta%bc[green]%~^?bt[Š&TART]@%bh&',button_grey_control,cont,b3_h,1)  ! NOTE - %BH used for the 3rd button
    ans=winio@('%ta%bf%fn[Courier New]Koniec programu:%ta%bc[red]%^?bt[&KONIEC]@%bh',knc,b4_h,1) ! NOTE - %BH used for the 4th button
...
...

Originally, when I used the %BH for all buttons, I made it according to ClearWin+ manual, where in Chapter HELP is described the use of %BH. At the end of this chapter, there is one sentence that: '...%th is used as an alternative to %`bh. %th provides a help bubble in the form of a “tooltip”.'

So, now, since %BH has a problem with the black area demonstrated above, I tried to use the %TH in the SAME manner like %BH, it means I replaced all %BH commands in my 4 buttons with %TH and got the run time demonstrated above which practically says that it is impossible to use %TH more than once. Based on this information, I let the %TH command ONLY for the 1st button and the rest 3 buttons have %BH as before - and everything works as expected (no black areas appear for the buttons with %BH), the bubble helps for all buttons look nice!

What does it mean? Generally speaking, should I understand that it is required and allowed to use the %TH only ONCE within a program and all other buttons must have %BH? I am totally confused here!

Your code above is - of coarse - crystal clear, I will re-program my code to have clear understanding of the code also for later use, but - really - I would like to know why %TH can be used only once in a program (has different philosophy than %BH?) and when the %TH is used once, whether it takes over the behaviour of %BH, when both are mixed and used as in my case above?

BTW - the function ENABLE_UTF8@(1) works with %TH problem free (all special slovakian letters are displayed correctly). It indicates some internal problem with %BH.

Thanks for the answer/s to my questions and for dispersing of my confusion!

Martin

15 Jun 2020 11:02 #25661

%th (or %bh) is only provided once. The help text is provided via the ? modifier on each item.

ClearWin+ know which item has been used and so can insert the corresponding help text at run time.

15 Jun 2020 11:03 #25662

Martin,

I don’t understand why you want to mix %th and %bh.

If you change the line

iw = winio@('%th[balloon]&', help_control)

in my example to

iw = winio@('%bh&', help_control)

you can see either %th or %bh for all buttons. %th is clearly better.

Note that in my example %th appears just once. The help string is added to the control via the @, which I think makes the code much more readable.

You are correct, the behaviour of %th and %bh differ for the case of a button which is inactive. I don’t think this is major issue, Paul may have a comment to make on this.

You should also consider adding an option to permit the user to turn the bubble help off. As soon as they become familiar with the program and what the controls do they rapidly find the help irritating.

Ken[img][/img]

15 Jun 2020 1:02 #25663

Paul - thanks. I thought that each button, for which the bubble help should be displayed, must have the %BH (or %TH) command. Your explanation is clear, thanks!

Ken, I do not want to mix %BH and %TH at all. Just I was going out from my bad premise that EACH button must have %BH (or %TH). So, initially, I replaced all %BH with %TH and I got the run time error (although there was no run time error when I had the %BH for all buttons). Therefore (to avoid the run time error) I used the %TH once and for all other buttons let the %BH, since it produced no run time error and my thought that all buttons must have either %BH or %TH was satisfied. Paul´s clarification is clear for me now and corrects my bad assumption.

And of coarse, I will built-in the possibility to switch off the bubble help. Thanks Ken!

Martin

Please login to reply.