Changing MDI menu item text

General discussion forum about all things Team Developer 7.x
Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 129
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Changing MDI menu item text

Post by Igor Ivanovic » 24 Jan 2018, 09:59

Hi,

I have a function that changes the text of some MDI menu items, depending on app parameters.
The problem I have is that every time a window is opened/closed the menu reverts to default.
IIRC there was a message sent to a MDI on which I could call my function to change the text.
The problem is I can't remember (nor find) which is the correct message.
Anyone have a hint?

Thx!
Igor Ivanovic
Image

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 124
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Changing MDI menu item text

Post by Jeff Luther » 24 Jan 2018, 17:02

The problem I have is that every time a window is opened/closed the menu reverts to default. IIRC there was a message sent to a MDI on which I could call my function to change the text.
One way to do this is to trap SAM_Create and SAM_CreateComplete msgs. and do necessary processing in them:

Code: Select all

On SAM_Create
    ! hide the window for the moment so any menu changes are not visible
    Call SalHideWindow( hWndForm )
    ! 
    ! change the newly-created window's menu(s)
    ! do whatever other one-time processing your code needs to do for this new form/dlg/table window

On SAM_CreateComplete
    ! do whatever other one-time finish processing your code might need to do for this new form/dlg/table window
    ! 
    ! done with any/all create changes, so display the window
    Call SalShowWindow( hWndForm )
I don't recall the details but this is basically how I coded it in Q for multi-language support for other than English, since we also supported French, German, Spanish, Portuguese and Japanese languages. We kept the English <--> [foreign language] pairs in XML files for each language & installed with Q, and parsed that file for the foreign language equivalent to change background text, titles, menus, etc. before the form was visible. I used a binary search routine to find the English text and return the foreign language text value and though there were (as I recall) some 700-800 items in the XML file, any item could be found within 5-6 binary search hits so it was very quick to changes all the text for a given form.

The code did this one time for the MDI window, then each time an activity was opened. In your case it will be faster since you only have menu text items to change.
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 56
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Re: Changing MDI menu item text

Post by thomas.uttendorfer » 25 Jan 2018, 08:36

Hi Igor,

the MDI menu changes (potentially) when a form-window or tableclass-window gets activated.
So we catch "On SAM_Activate" on every of these window and manipulate the mdi menu then.

Regards Thomas
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

EwaldP
Austria
Posts: 58
Joined: 07 Mar 2017, 08:00
Location: Austria

Re: Changing MDI menu item text

Post by EwaldP » 26 Jan 2018, 07:52

Same solution here. In the class of each windows we rebuild the menu structure On SAM_Activate.
Ewald P. Palmetshofer
EDV-Hausleitner GmbH
4020 Linz
www.edv-hausleitner.at

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 129
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: Changing MDI menu item text

Post by Igor Ivanovic » 27 Jan 2018, 17:34

Thanks guys!

Will go with the class SAM_Activate route.
Igor Ivanovic
Image

Return to “General Discussion”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests