Using Delphi XE7 and Planner 3.3.4.0.
In a day view, the scroller is shown because of having more lines than the available screen space.
When the planner is first displayed, or when I change the day, mousewheel is not active unless the user clicks on an item. I tried different solutions without success, So how can I activate by code the mousewheel without the user needing to click anywhere.
var
tpi:TPlannerItem;
begin
tpi := Planner.Items[0];
Planner.Items.Select(tpi);
Planner.SetFocus;
end;
What exact action do you want the mousewheel to perform? The default action is that it scrolls the selection in the Planner and I have retested this here with the latest version of the Planner and this is what it does when hovering the mouse over the Planner and scrolling the mousewheel.
The problem is that if I select an item by code with the given example (and other ways I also have tested) it seems that the item is not really selected, and then the mousewheel does not move nothing in the planner.
Otherwise, if I select an item with a mouse click over it, then the mousewheel moves the planner.
The selection moves when the Planner has the focus and receives the mousewheel messages. You can set the focus on the Planner programmatically with Planner.SetFocus;
You can see the code posted in the first message of thethread, I repeat the code here.
var
tpi:TPlannerItem;
begin
Planner.SetFocus;
tpi := Planner.Items[0];
Planner.Items.Select(tpi);
Planner.SetFocus;
end;
Using this code, the first item in the planner is not selected and the mousewheel does not move the planner.
From where do you execute this code?
Please provide a full, precise, detailed description of you what you do, preferably provide a sample source project and detailed steps how to reproduce the problem.
A calendar is shown, and when the user clicks on a date, the following code is executed (Some lines that does not matter are deleted).
After that, if I move the mousewheel, nothing happens
PlannerD.Items.BeginUpdate;
for iK := 0 to mclsvisD.Count-1 do
begin
with (PlannerD.Items.Add) do
begin
ItemPos := 0;
ItemStartTime := PlannerD.Mode.Date + TimeOf(mclsVisD.tArrVisitas[iK].tHora)
ttm := IncMinute(mclsVisD.tArrVisitas[iK].tHora, mclsVisD.tArrVisitas[iK].iDuracion);
ItemEndTime := PlannerD.Mode.Date + TimeOf(ttm);
Text.Text := mclsVisD.tArrVisitas[iK].sDescripcion;
Tag := mclsVisD.tArrVisitas[iK].lId;
end;
end;
PlannerD.Items.EndUpdate;
tpi := PlannerD.SelectCells(0, 0, 1);
PlannerD.SetFocus;
PlannerD.Items.Select(tpi);
PlannerD.SetFocus;
When using a Planner and clicking it and/or programmatically setting the focus to it like in your code, I cannot see any issue using the mouse wheel. The mouse wheel always changes the Planner selected cell when it has focus.
So, again, I ask to isolate this, provide some sample source project + clear & detailed steps how this can be reproduced with the latest version of the Planner.