PxPlus User Forum

Twitter Twitter Twitter

Author Topic: change caption using titlebars  (Read 3180 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
change caption using titlebars
« on: October 29, 2018, 05:57:56 AM »
I encounter issues when changing the window caption while using titlebars.
As a fonted text with =px_titlebar_caption$ cannot be changed afterwards, I tried many different attribute settings with a multiline control. So far I could not find a satisfying solution. A multiline control always becomes visible if the user clicks and drags into it. The window cannot be moved, if the user clicks on the multiline control.
What is the best practice to change the window caption using titlebars?

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 280
    • View Profile
    • PVX Plus Technologies
Re: change caption using titlebars
« Reply #1 on: October 29, 2018, 08:34:54 AM »
Thomas,
Changing the caption of a panel is the same with or without a title bar:
PRINT 'CAPTION'("New Title"),

Jane Raymond
Software Developer
PVX Plus Technologies Ltd.

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: change caption using titlebars
« Reply #2 on: October 29, 2018, 11:07:20 AM »
Yes, that still changes the window title, but it is not visible any more using titlebars.
I just did a quick test with PxPlus V14:
Button 1 does: print 'caption'(dte(0:"%Hz%mz%sz")),
Button 2 does: multi_line read 0,_$;msgbox _$, px_titlebar_caption$

While the window title is technically changed, the associated variable px_titlebar_caption$ remains the unchanged. That requires own logic for the visibility of the title change.
Is this the intended behavior?

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 280
    • View Profile
    • PVX Plus Technologies
Re: change caption using titlebars
« Reply #3 on: October 29, 2018, 12:10:09 PM »
Thomas,
The title on the titlebar is displayed using a fonted text control called PX_TITLEBAR_CAPTION. You can change the panel title using:
PRINT 'CAPTION'(dte(0:"%Hz%mz%sz")),


Do not use a multi-line. We have an internal variable called PX_TITLEBAR_CAPTION$ that we manipulate when the title bar is changed with the PRINT 'CAPTION'() mnemonic.


The concept is that your old code which would have changed the window caption with a PRINT 'CAPTION'() still works with a title bar.
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: change caption using titlebars
« Reply #4 on: October 30, 2018, 08:03:12 AM »
Thank you Jane. Now it works.
I didn't notice to name the control "px_titlebar_caption". I only aasigned that variable as an expression.

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: change caption using titlebars
« Reply #5 on: October 30, 2018, 08:38:26 AM »
When we introduced these at the DireXions conference, we suggested that you start by copying an existing titlebar definition so that the control names and logic would be correct. 

Unfortunately the logic needs the controls in the header to have specific names otherwise it will not function correctly.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: change caption using titlebars
« Reply #6 on: November 02, 2018, 06:54:49 AM »
I'm sorry to bother you again with this.
As the captions of some of my titlebars are still not changed, I took a deeper look. It turns out, that the px_titlebar_caption control is not changed during the post display logic. It is only changed during event logics. In case of a *nomads class the caption is never changed. Neither in postLoad(), nor in an event logic.
Can you reproduce this with PxPlus V14?

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 280
    • View Profile
    • PVX Plus Technologies
Re: change caption using titlebars
« Reply #7 on: November 02, 2018, 10:37:58 AM »
Thomas,
I'm sorry to say that I cannot duplicate what you are describing in v14 or v15.


I created a panel with Post_Display logic that does PRINT 'CAPTION'("new title"),
I process the panel using PROCESS "mypanel","mylib" and the title in the title bar changes.


I also created a panel using a Nomads object that does PRINT 'CAPTION'("new title") in the POSTLOAD() logic.
I instantiate the object and process the panel with myobj'Process(), and the title bar changes.


The way it works is this:
IF there is a title bar on the panel, the SignalCaptionChg option is set to -1109. This means that whenever a PRINT 'CAPTION'() is executed a CTL value of -1109 is generated.
When the -1109 CTL is detected, the new caption is retrieved using a MULTI_LINE READ 0, and the result is redrawn as a font image.
All of this should happen automatically if you have created a fonted text control called PX_TitleBar_Caption on your title bar.



Jane Raymond
Software Developer
PVX Plus Technologies Ltd.

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: change caption using titlebars
« Reply #8 on: November 05, 2018, 10:56:12 AM »
In the post display logic of many of our panels a 'CI' mnemonic is issued in order to clear the input buffer from whatever has been typed ahead.
So this is the reason why the change of the caption isn't correctly reflected everywhere.

After removing some of the central occurrences things work better, but not entirely. I found statement 2473 in *winproc, which issues a 'CI'. I removed the mnemonic and now the titles are reflected correctly ... ... ... so far.
Is it save to remove it or what other change to *winproc needs to made?

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 280
    • View Profile
    • PVX Plus Technologies
Re: change caption using titlebars
« Reply #9 on: November 06, 2018, 01:17:57 PM »
I would not arbitrarily remove the 'ci' from statement 2473 in *winproc.
There is a Nomads variable called NO_FLUSH that you can set to 1 to avoid the buffer flush at 2473.
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: change caption using titlebars
« Reply #10 on: November 08, 2018, 05:03:00 AM »
As it turns out omitting 'CI' produces unpredictable side effects in our application. So this is not an option.
I tried to add the logic from *winproc (line 1202) to our caption changes, but _tbarCaptionInfo$ is always empty unless ctl has a value of -1109.
Can you permamently provide _tbarCaptionInfo$, so I can do an instant caption change where needed? What other solution do you suggest?

BTW, the option "merge-jumpto" seems to ignore the title bar, though it is defined in the library defaults.

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 280
    • View Profile
    • PVX Plus Technologies
Re: change caption using titlebars
« Reply #11 on: November 08, 2018, 08:42:37 AM »
Thomas,

If you have to PRINT 'CI', just do it prior to changing the caption so it doesn't swallow the -1109.

As for the merge-jumpto option, that is used for concurrent windows, and the Custom Title Bars documentation notes explicitly at the end of the Assigning Custom Title Bars section:

Important Note:
If a title bar has been assigned using any of the above methods, it will not be displayed on panels that:

  • Have been defined as Widgets,
  • Have Auto-Scroll Resizing set,
  • Are concurrent windows
  • Are not wide enough to display the title bar.
« Last Edit: November 08, 2018, 09:11:41 AM by Mike King »
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.