Uniface User Forum

 View Only
  • 1.  Add a popup menu to every painted field

    Posted 06-26-2022 04:52
    I'm trying to find an easy way of adding a popup menu to every painted field. I have tried this:

    variables
        vPosn  
        string vTemp
    endvariables

    clear/e "uxfield"
    retrieve/e "uxfield"
    setocc "uxfield",1
    while($status > 0)
       if(upopup = "") upopup.uxfield = "FLDRIGHT"
    setocc "uxfield", $curocc(uxfield) + 1
    endwhile

    but it doesn't work, I've also tried to put the value in ucomment.uxfield directly in meta data but this didn't work either. Fields are not templated and although now using 10.3.02, it started life in uniface 5.

    Any ideas please on how I can do this? Many thanks!

    ------------------------------
    Toni Davenport
    Uniface Community Edition Shared Account
    US
    ------------------------------


  • 2.  RE: Add a popup menu to every painted field

    PARTNER
    Posted 06-27-2022 09:24
    Possibly a dumb question (just that its not mentioned) but are you storing and committing the changes and compiling the screen afterwards?

    ------------------------------
    Mike Porter
    Equiniti Group
    Belfast, UK
    ------------------------------



  • 3.  RE: Add a popup menu to every painted field

    Posted 06-27-2022 10:12
    Yes I am. Initially it did say database modification not allowed, on checking the uxfield model definition, it was set to no updates, so I changed it to cautious, it then goes through the write trigger, etc but doesn't store even though it doesn't say it hasn't, if that makes sense.

    ------------------------------
    Toni Davenport
    Uniface Community Edition Shared Account
    US
    ------------------------------



  • 4.  RE: Add a popup menu to every painted field

    PARTNER
    Posted 06-27-2022 10:51
    Odd... I've made code changes through automated utility before so there shouldn't be a specific block on popups unless its a U10 thing. Have you checked the generated SQL for the write to ensure the changes are in there? Some other thoughts:
    • What about the field syntax on your bulk update "screen", does that contain a NED / DIM setting on upopup (shouldn't be an issue for changes made by code but worth a look with these XML columns)?
    • Outside chance, does the popup menu you are setting it to exist in the same library as the component is setup for (would still show up in the table I guess)?
    • A more involved query, where does your DICT model come from? Is it migrated from U9 (or earlier) or created from the umeta.xml in U10? The modelled definition for the segmented DICT fields used to be available in ulibrary.xml as well I think. What about database triggers/functions for reading and writing the meta data - not sure where they should come from in 10? I imagine if the problem were here it would cause issues for the IDE as well so unlikely.


    ------------------------------
    Mike Porter
    Equiniti Group
    Belfast, UK
    ------------------------------



  • 5.  RE: Add a popup menu to every painted field

    Posted 06-27-2022 13:31
    Edited by Knut Dybendahl 06-27-2022 13:31
    HI Toni,

    More of a brute force approach?
    $ude --> export to XML
    read exported XML file as a TXT file
    do a $replace on the tag you want / need
    save back to XML file
    $udf --> import XML file.

    Done

    Regards,
    Knut

    ------------------------------
    Knut Dybendahl
    ------------------------------



  • 6.  RE: Add a popup menu to every painted field

    Posted 06-29-2022 04:28
    My first approach would be to add manually the requirement to one field in one component, and check it has the desired effect.

    Then do an xml export and see what has been generated.
    Then use notepad ++ to change the desired text using regex; first with one component and then the lot.
    Although, it would give the same results as doing direct sql on the uxfield table.

    Both ways should definitely work.

    Another thought is why not use ucfield instead.  It will then be in place for all future new fields, it that is desirable ;-)

    ------------------------------
    Osman Shariff
    ------------------------------



  • 7.  RE: Add a popup menu to every painted field

    Posted 06-29-2022 08:15
    Hi Osman

    Using direct SQL on UXFIELD could be 'dangerous'.... 
    Remember, there are a number of control characters embedded in the extended part of the record....
    for all the triggers, html options et al...

    UCFIELD is an option - alas - you'll still have the same challenge as above.

    Regards,
    Knut

    ------------------------------
    Knut Dybendahl
    ------------------------------



  • 8.  RE: Add a popup menu to every painted field

    Posted 06-29-2022 09:18
    Hi

     I just had a look and upopup is part of ucomment so probably best not to go the dangerous root :-)

    So, I would go with this:-

    1. Create an xml export file of a component or all components

    2. Cut out this part and paste it into notepad ++
    <TABLE>
    <DSC name="UXFIELD"
    ..
    ..
    </TABLE>


    3.  Ctrl H - search and replace in notepad ++

    a. Set search mode as regular expression

    Find
    b. ^</DAT>\r\n(<DAT name="FRM_WIDGETTYPE">EDITBOX</DAT>)

    c. Replace
    </DAT>\r\n<DAT name="UPOPUP">MYPOPUP</DAT>\r\n\1\r\n


    4. Copy all of the new code  ctrl-a, ctrl-c

    5. Paste it back in the original position of the xml file 

    6. Save

    7. import

    8. see if it worked

    ------------------------------
    Osman Shariff
    ------------------------------



  • 9.  RE: Add a popup menu to every painted field

    Posted 07-03-2022 06:51
    Thank you all for your helpful comments. I have managed to get it done, I don't know whether I had some weird lock on the table for some reason, but I came back to my original code a few days later and hey presto, it stored and is now all sorted. Either that, or I must have been having a mad moment, but thank you all!

    ------------------------------
    Toni Davenport
    Uniface Community Edition Shared Account
    US
    ------------------------------



  • 10.  RE: Add a popup menu to every painted field

    Posted 06-29-2022 08:18
    Hi Toni,

    I just read the last part of your post...
    I presume you have upgraded / updated the DICT model with 10.3.02 definitions?
    Also, remember - the write and lock triggers is always empty in the model definition.

    Regards,
    Knut

    ------------------------------
    Knut Dybendahl
    ------------------------------