Jump to content

Desktop UniPageControl - Event Required BEFORE Activating Page Change (with option to prevent) - How ?


Recommended Posts

Posted

We need the provision for a Desktop UniPageControl Event to advise the program of a user ChangePage Request with the option in code to prevent/cancel the page change (not show the specified TabSheet).

The only event that is fired (none of the Uni/Ext Events fire)  is 'tabchange' but as you can see it is after the event, also there is no way to prevent the change. 

Please advise - thanks

Posted
14 minutes ago, andyhill said:

We need the provision for a Desktop UniPageControl Event to advise the program of a user ChangePage Request with the option in code to prevent/cancel the page change (not show the specified TabSheet).

The only event that is fired (none of the Uni/Ext Events fire)  is 'tabchange' but as you can see it is after the event, also there is no way to prevent the change. 

Please advise - thanks

\FMSoft\Framework\uniGUI\Demos\Desktop\PageControl - BeforeActivate

?

Posted

My work around is still messy (lots of flag switching and re-activating).

The problem for me is you have a Sheet Activate Event that expects either a True / False result (BeforeActivate(Sender: TObject; var AllowActivate: Boolean);) which is not ideal if one needs to carry out some dynamic interaction with the user before allowing:-

1) Catch the Activating Request

2) Solicit Password from user

3) If valid password then Activate Sheet else deny

 

Posted
On 9/4/2020 at 7:18 PM, andyhill said:

My work around is still messy (lots of flag switching and re-activating).

The problem for me is you have a Sheet Activate Event that expects either a True / False result (BeforeActivate(Sender: TObject; var AllowActivate: Boolean);) which is not ideal if one needs to carry out some dynamic interaction with the user before allowing:-

1) Catch the Activating Request

2) Solicit Password from user

3) If valid password then Activate Sheet else deny

 

Do you need OnChanging(Accept:Boolean) event?

Posted

I need intent to change, then Prompt for Password, validate password and if correct then change to Sheet else not change (as stated 1, 2, 3 above).

Posted
3 hours ago, andyhill said:

I need intent to change, then Prompt for Password, validate password and if correct then change to Sheet else not change (as stated 1, 2, 3 above).

The first option for your case is using MainModule.EnableSynchronousOperations = True

For example:

procedure TMainForm.UniTabSheet3BeforeActivate(Sender: TObject;
  var AllowActivate: Boolean);
begin
  if UniForm3.ShowModal = mrOk then
    AllowActivate := True
  else
    AllowActivate := False;

  if not AllowActivate then
    ShowMessage('You can not see this TabSheet!');
end;

 

Posted

I appreciate your help Sherzod but my understanding is that the BeforeActivate event is lost once I prompt the user for a password, as mentioned before I have managed a work around.

Ideally the BeforeActivate should have a CallBack so I can further interact with user, then if happy with the challenge response continue with the event allowing activation or denying.

Posted

What I do need desperately is the Desktop PopUpMenu Y Overflow (cater for hundreds of items) that I have raised a ticket for plus of course the Mobile DBListGrid DoubleTap (also ticketed a long time ago), hopefully when I am back they will be resolved. 

Posted
12 minutes ago, andyhill said:

What I do need desperately is the Desktop PopUpMenu Y Overflow (cater for hundreds of items) that I have raised a ticket for plus of course the Mobile DBListGrid DoubleTap (also ticketed a long time ago), hopefully when I am back they will be resolved. 

Remind us again please, we'll check. But, preferably, always attach test cases so we can reproduce and see the problem.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...