Results 1 to 10 of 24

Thread: Simple qyestion - Send ShowYesNo

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2016
    Location
    Point Cook, Victoria, Australia
    Posts
    595

    Default Simple qyestion - Send ShowYesNo

    SIMPLE QUESTION, NOT QYESTION

    Hi everyone,

    I'm fairly new to writing Webapps, and so far I've written two. One has been in use for about 6 years, while the other, for almost two years. Both work perfectly, and while they are based on the simple Windows-like UI, one of my Webapps would benefit from the multi-device Mobile interface, although my question has nothing to do with this. I'm only outlining my Webapp experience here...

    Now, to my current query.
    This code, as per Studio Help works perfectly in normal usage if used at it's most basic, which is how I am currently using it in several places in both Webapps, i.e., using ShowYesNo within buttons:
    Code:
    Object oChangeButton is a cWebButton
        Set psCaption to "Click me"
    
        Procedure ButtonCallback Integer eConfirmMode
            If (eConfirmMode=cmYes) Begin
                WebSet psCaption to (CurrentDateTime())
            End
        End_Procedure
        
        // this tells the system that this method is allowed for this object
        WebPublishProcedure ButtonCallback
        
        Procedure OnClick
            // do confirmation and call this object's ButtonCallback message with the results
            Send ShowYesNo (Self) (RefProc(ButtonCallback)) "Update this" "Question" 
        End_Procedure
        
    End_Object
    What I would like to do is place ShowYesNo, ideally, within the CLASS DECLARATION of one of my DDOs; specifically within Request_Validate. Alternatively, within the view's DDO OBJECT DECLARATION would suffice, but again, still within it's Request_Validate function.

    My issue is that I cannot get it to work, and I've spent days trying to get it to work; both in the DDO class declarartion as well as in the view's DDO object declarartion.

    BTW, the manner in which I need it to work within Request_Validate is by using a property which can contain a value of either a 0 or a 1 (which is set in the ShowYesNo's callback procedure). If the Yes button of the ShowYesNo dialogue is clicked then the property is given a value of 0 and validation will continue, otherwise if the No button is clicked, the property is set to a value of 1, and a Function_Return 1 will be performed, meaning that the validation failed. In other words, under certain situations, I need the user to be to able to decide if the validation should fail!

    I've tried so many ways to get this working, but no matter what I do, my code fails to operate correctly. The best I can do, is that the ShowYesNo dialogue is displayed, but the Webapp totally ignores the response from ShowYesNo's Yes and No buttons and the save is still performed - the WebApp then locks up with the ShowYesNo dialogue still displayed!

    The reason why I would rather have the ShowYesNo in the class declaration of the DDO is because this DDO is used in multiple views, so if I can place it in the class declaration, the code is then in one place, rather than having to write duplicate code within each of the views. In other words, I want the class to be stand alone and totally encapsulated!

    I hope I have explained this properly, but maybe I should explain why I even need to use a ShowYesNo dialogue in the first place:
    The DDO stores all manner of information as well as a start date and time and a finish date and time, and if the time difference is greater than 8 hours, then it is up to the user to decide whether to allow the save, or not. As mentioned, I would rather have it encapsulated in the class declaration of the DDO so that when other views use this class, all views are aware of the 8 hour limitation - although, as mentioned, I need the user to decide whether it's ok to save the record if it is over 8 hours.
    Last edited by Rachael; 30-Nov-2024 at 11:44 PM.
    Regards,
    Rachael Warlond

    1) When programming, never reinvent the wheel.
    2) If it works, leave well enough alone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •