1. Tracy Lamb
  2. PowerBuilder
  3. Wednesday, 11 May 2022 15:25 PM UTC

Hi all,

I'm using the latest PFC in my PB2021 development.  In the u_dw object, I over-ride the anscestor pfc script for lbuttondown, lbuttonup, rbuttondown, and rbuttonup events.  In the descendent dw, I add the following code to the rbuttonup event:

//Over-ride

// Don't do anything if a valid row isn't clicked
if IsNull( row ) then
return
end if

//If this is the first row, only allow insert
if this.Rowcount() = 0 then
im_popup.m_calform.m_testpoints.m_append.Enabled = FALSE
im_popup.m_calform.m_testpoints.m_delete.Enabled = FALSE
im_popup.m_calform.m_testpoints.m_creategroup.Enabled = FALSE
im_popup.m_calform.m_testpoints.m_renamegroup.Enabled = FALSE
im_popup.m_calform.m_testpoints.m_cutrows.Enabled = FALSE
im_popup.m_calform.m_testpoints.m_copyrows.Enabled = FALSE
im_popup.m_calform.m_testpoints.m_pasterows.Enabled = FALSE
end if

im_popup.of_SetParent( this )
im_popup.m_calform.m_testpoints.PopMenu( iw_frame.PointerX(), iw_frame.PointerY() )

This works fine.  The m_insert and m_append call user events, not the pfc events.  After the user event executes, another pop-up menu shows up... I don't know where it's coming from... the options on the strange pop-up are:

copy
paste
delete
select all
right to left reading order
show unicode control characters
insert unicode control characters
open IME
reconversion

Any ideas?

~~~Tracy

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 11 May 2022 15:40 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi, Tracy - 

What return value is issued by the script that issues the PopMenu PowerScript function?

If this function is issued in a mapped system event (such as rbuttonup, mapped to pbm_dwnrbuttonup, for example), then you should issue Return 1 to inform the window's behind-the-scenes WindowsProc message handler that your script has handled the event and it should NOT be propagated up the event handler hierarchy.

Look at the code in the RButtonUp event in pfc_u_dw (pfcmain.pbl) for an example of what I'm referring to. There are several other PopMenu examples in other PFC ancestor objects.

Best regards, John

Comment
  1. Tracy Lamb
  2. Wednesday, 11 May 2022 17:41 PM UTC
Thank you. I added return 1 at the bottom and it works.

  1. Helpful 1
  1. John Fauss
  2. Wednesday, 11 May 2022 18:18 PM UTC
Great news! You're welcome! If you have not already done so, may I suggest adding a comment preceding the "Return 1" statement that explains why a return value of 1 is being issued? Anyone examining your code in the future will then better understand the importance of doing this. Also note that should you extend an ancestor event script instead of overriding it (as you properly did in this particular case), you might wish to return the ancestor script's return value from your extended event script via the AncestorReturnValue special local variable, depending on the circumstances.
  1. Helpful 1
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 11 May 2022 16:35 PM UTC
  2. PowerBuilder
  3. # 1

Hi,

Do a search in your application on for example "show unicode control characters" (without the double quotes). See which object it is and then do a search on that object, to see where it's used.

regards.

Comment
  1. Tracy Lamb
  2. Wednesday, 11 May 2022 17:45 PM UTC
I searched for "unicode"... haven't found any menu objects associated. Most references are for pfc_n_cst_conversion, f_filesrv, and f_setplatform
  1. Helpful
  1. Benjamin Gaesslein
  2. Thursday, 12 May 2022 06:39 AM UTC
You can't find this in PB because it's the default context menu for TextBox controls provided by Windows.
  1. Helpful 2
  1. Miguel Leeuwe
  2. Thursday, 12 May 2022 06:57 AM UTC
As always, thanks for explaining that Benjamin!
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.