A method for controlling the operation of a motorized drive device of a sliding window for a building, the sliding window comprising: - a frame, - at least one leaf (3a, 3b), - a device for locking the leaf relative to the frame in a locked partially open position, the locked partially position being arranged between an open position and a closed position of the leaf relative to the frame, the motorized drive device being configured to move the leaf by sliding relative to the frame, the motorized drive device comprising: - an electromechanical actuator, the electromechanical actuator comprising an electronic control unit and an electric motor, the locking device comprising: - a first subassembly, the first subassembly being fastened on the frame, - a second subassembly, the second subassembly being fastened on the leaf, the second subassembly being configured to cooperate with the first subassembly, during a movement of the leaf relative to the frame, so as to be able to lock the leaf relative to the frame in the locked partially open position, characterized in that the locked partially open position of the leaf relative to the frame corresponds to a locked position of the second subassembly relative to the first subassembly, in that the method comprises at least the following step, carried out during a configuration phase of the motorized drive device: - determining reference positions (P1, P2, P3) of the second subassembly relative to the first subassembly, said reference positions (P1, P2, P3) comprising at least a docking position of the second subassembly relative to the first subassembly, the docking position being arranged before the locked partially open position of the leaf relative to the frame, in the opening movement direction of the leaf relative to the frame, in that the method comprises at least the following steps, carried out during a command phase of the motorized drive device: - reception of a movement command order by the electronic control unit of the electromechanical actuator, - moving the leaf relative to the frame at a first speed input or a second speed input, based on the received movement command order, at least one previous executed movement command order and the position of the second subassembly relative to the first subassembly, according to the determined reference positions (P1, P2, P3), the second movement speed input being less than the first movement speed input, and in that, when a command order to move to the locked partially open position is received by the electronic control unit, the movement of the leaf relative to the frame comprises a first movement in the closing direction of the leaf relative to the frame implemented at the second speed input, so as to move the second subassembly relative to the first subassembly to the docking position, then a second movement in the opening direction of the leaf relative to the frame implemented at the second speed input, so as to move the second subassembly relative to the first subassembly from the docking position to the locked position. - a frame, - at least one leaf (3a, 3b), - a device for locking the leaf relative to the frame in a locked partially open position, the locked partially position being arranged between an open position and a closed position of the leaf relative to the frame, - an electromechanical actuator, the electromechanical actuator comprising an electronic control unit and an electric motor, - a first subassembly, the first subassembly being fastened on the frame, - a second subassembly, the second subassembly being fastened on the leaf, the second subassembly being configured to cooperate with the first subassembly, during a movement of the leaf relative to the frame, so as to be able to lock the leaf relative to the frame in the locked partially open position, - determining reference positions (P1, P2, P3) of the second subassembly relative to the first subassembly, said reference positions (P1, P2, P3) comprising at least a docking position of the second subassembly relative to the first subassembly, the docking position being arranged before the locked partially open position of the leaf relative to the frame, in the opening movement direction of the leaf relative to the frame, - reception of a movement command order by the electronic control unit of the electromechanical actuator, - moving the leaf relative to the frame at a first speed input or a second speed input, based on the received movement command order, at least one previous executed movement command order and the position of the second subassembly relative to the first subassembly, according to the determined reference positions (P1, P2, P3), the second movement speed input being less than the first movement speed input,