Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Unexpected behaviour for Select() method, is it async?

(1) ShareShare
ReportReport
Posted on by 99
​Hi all,
 
I have two buttons, the first one named btnChassisRow with the following OnSelect:
 
If(
    rightClickListener1.isPressed;
    UpdateContext({ctxDoubleClicked: true});
    If(
        "Control" in Split(
            pressedKeys1.pressedKeys;
            ", "
        );
        Select(cbSelectedRow);;
        UpdateContext({ctxSelectedVehicle: ThisItem});;
        ;
        UpdateContext({ctxClicked: !ctxClicked});;
        If(
            !ctxClicked And ctxStarted And ctxSelectedVehicle.Chassis = ThisItem.Chassis;
            UpdateContext({ctxDoubleClicked: true});;
            ;
            UpdateContext(
                {
                    ctxDoubleClicked: false;
                    ctxSelectedLocation: Blank()
                }
            );;
        );;
        UpdateContext({ctxSelectedVehicle: ThisItem});;
        Reset(timerHoldForDetails);;
        UpdateContext(
            {
                ctxDisplayVehicleMoves: false;
                ctxDisplayEditVehicle: false
            }
        );;
        Copy(Self.Text);;
    );;
    
);;
 
The second one has the following OnSelect:
 
Select(btnChassisRow);;
Copy(Self.Text);;
 
The expected behaviour would be to first Copy() the Text property of btnChassisRow, then replace the copied content with the Copy() from the second button.
However, I end up having the btnChassisRow's Text in my clipboard after selecting the second button
 
  • BaptisteW Profile Picture
    BaptisteW 99 on at
    Unexpected behavior for Select() method, is it async?
    Sadly no.

    I fixed it in my app by introducing a new variable

    1st button
    If(
        !ctxPreventCopyChassis;
        Copy(Self.Text)
    );;


    2nd button
    UpdateContext({ctxPreventCopyChassis: true});;
    Select(btnChassisRow);;
    Copy(Self.Text);;
    UpdateContext({ctxPreventCopyChassis: false});;

  • KeithAtherton Profile Picture
    KeithAtherton 3,640 on at
    Unexpected behavior for Select() method, is it async?
    Hey. I would also expect the behaviour that you mention.
     
    If you change the second button code rom this:
    Copy(Self.Text);;
    To this:
    Copy(btnSecondButton.Text);;
     
    Does it behave any differently?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard