Проблема Проблема с TVStyle в компонентах

justdj

Новичок
Проблема с TypesCombo

Без TVStyle работает. с TVStyle нет.

Использую показ картинок+компоненты+выбор компонента по нажатию.

Просто не знаю что делать... Код кину в лс.

11.jpg 12.jpg
 
Последнее редактирование:

sergey3695

Ветеран
Модератор
ни это?
Код:
[setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}

[Languages]
Name: "rus"; MessagesFile: "compiler:Languages\Russian.isl"

[Components]
Name: Mode; Description: mode; Types: custom; flags: fixed
Name: Mode/SPOnly; Description: SPOnly; Flags:  disablenouninstallwarning
Name: Mode/MPOnly; Description: MPOnly; Flags: disablenouninstallwarning
Name: Mode2; Description: mode; Types: custom; flags: fixed
Name: Mode2/SPOnly2; Description: SPOnly2; Flags: disablenouninstallwarning
Name: Mode2/MPOnly2; Description: MPOnly2; Flags: disablenouninstallwarning

[Code]
type
    TCheckListBoxHelper = record
        Index: Integer;
        ItemArea: TItemArea;
    end;

var
   CLBHelper: TCheckListBoxHelper;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ComponentsListOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if (Button = mbLeft) and (CLBHelper.ItemArea = iaItem) then
  begin
    with TNewCheckListBox(Sender) do
    begin
      if ItemEnabled[CLBHelper.Index] then
      begin
        case State[CLBHelper.Index] of
          cbUnchecked,
          cbGrayed:
            CheckItem(CLBHelper.Index, coCheckWithChildren);
          cbChecked:
            CheckItem(CLBHelper.Index, coUncheck);
        end;
      end;
    end;
  end;
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ComponentsListOnItemMouseMove(Sender: TObject; X, Y: Integer; Index: Integer; Area: TItemArea);
begin
    CLBHelper.Index := Index;
    CLBHelper.ItemArea := Area;
end;

procedure InitializeWizard;
begin
    with WizardForm.ComponentsList do
    begin
        TreeViewStyle:= True;
        if TreeViewStyle then
        begin
            OnMouseDown := @ComponentsListOnMouseDown;
            OnItemMouseMove := @ComponentsListOnItemMouseMove;
        end;
    end;
end;
 

justdj

Новичок
ни это?
Код:
[setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}

[Languages]
Name: "rus"; MessagesFile: "compiler:Languages\Russian.isl"

[Components]
Name: Mode; Description: mode; Types: custom; flags: fixed
Name: Mode/SPOnly; Description: SPOnly; Flags:  disablenouninstallwarning
Name: Mode/MPOnly; Description: MPOnly; Flags: disablenouninstallwarning
Name: Mode2; Description: mode; Types: custom; flags: fixed
Name: Mode2/SPOnly2; Description: SPOnly2; Flags: disablenouninstallwarning
Name: Mode2/MPOnly2; Description: MPOnly2; Flags: disablenouninstallwarning

[Code]
type
    TCheckListBoxHelper = record
        Index: Integer;
        ItemArea: TItemArea;
    end;

var
   CLBHelper: TCheckListBoxHelper;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ComponentsListOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if (Button = mbLeft) and (CLBHelper.ItemArea = iaItem) then
  begin
    with TNewCheckListBox(Sender) do
    begin
      if ItemEnabled[CLBHelper.Index] then
      begin
        case State[CLBHelper.Index] of
          cbUnchecked,
          cbGrayed:
            CheckItem(CLBHelper.Index, coCheckWithChildren);
          cbChecked:
            CheckItem(CLBHelper.Index, coUncheck);
        end;
      end;
    end;
  end;
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ComponentsListOnItemMouseMove(Sender: TObject; X, Y: Integer; Index: Integer; Area: TItemArea);
begin
    CLBHelper.Index := Index;
    CLBHelper.ItemArea := Area;
end;

procedure InitializeWizard;
begin
    with WizardForm.ComponentsList do
    begin
        TreeViewStyle:= True;
        if TreeViewStyle then
        begin
            OnMouseDown := @ComponentsListOnMouseDown;
            OnItemMouseMove := @ComponentsListOnItemMouseMove;
        end;
    end;
end;
Оно самое
 

justdj

Новичок
ни это?
Код:
[setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}

[Languages]
Name: "rus"; MessagesFile: "compiler:Languages\Russian.isl"

[Components]
Name: Mode; Description: mode; Types: custom; flags: fixed
Name: Mode/SPOnly; Description: SPOnly; Flags:  disablenouninstallwarning
Name: Mode/MPOnly; Description: MPOnly; Flags: disablenouninstallwarning
Name: Mode2; Description: mode; Types: custom; flags: fixed
Name: Mode2/SPOnly2; Description: SPOnly2; Flags: disablenouninstallwarning
Name: Mode2/MPOnly2; Description: MPOnly2; Flags: disablenouninstallwarning

[Code]
type
    TCheckListBoxHelper = record
        Index: Integer;
        ItemArea: TItemArea;
    end;

var
   CLBHelper: TCheckListBoxHelper;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ComponentsListOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if (Button = mbLeft) and (CLBHelper.ItemArea = iaItem) then
  begin
    with TNewCheckListBox(Sender) do
    begin
      if ItemEnabled[CLBHelper.Index] then
      begin
        case State[CLBHelper.Index] of
          cbUnchecked,
          cbGrayed:
            CheckItem(CLBHelper.Index, coCheckWithChildren);
          cbChecked:
            CheckItem(CLBHelper.Index, coUncheck);
        end;
      end;
    end;
  end;
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ComponentsListOnItemMouseMove(Sender: TObject; X, Y: Integer; Index: Integer; Area: TItemArea);
begin
    CLBHelper.Index := Index;
    CLBHelper.ItemArea := Area;
end;

procedure InitializeWizard;
begin
    with WizardForm.ComponentsList do
    begin
        TreeViewStyle:= True;
        if TreeViewStyle then
        begin
            OnMouseDown := @ComponentsListOnMouseDown;
            OnItemMouseMove := @ComponentsListOnItemMouseMove;
        end;
    end;
end;
Не подскажете?
 

Kotyarko_O

Новичок
Хамик, вопрос задан как раз по работе этого кода.
При использовании такого способа и включённом TVStyle, при выборе компонентов (а конкретно: нажатии на строку имени), не меняется тип установки. При нажатии на сам чекбокс всё нормально.
 

sergey3695

Ветеран
Модератор
justdj, да фигню написал. я прям уверен если
Код:
if TreeViewStyle then
begin
OnMouseDown := @ComponentsListOnMouseDown;
OnItemMouseMove := @ComponentsListOnItemMouseMove;
end;
заменить на это
Код:
if TreeViewStyle or TVStyle then
begin
OnMouseDown := @ComponentsListOnMouseDown;
OnItemMouseMove := @ComponentsListOnItemMouseMove;
end;
то заработает.
 

justdj

Новичок
justdj, да фигню написал. я прям уверен если
Код:
if TreeViewStyle then
begin
OnMouseDown := @ComponentsListOnMouseDown;
OnItemMouseMove := @ComponentsListOnItemMouseMove;
end;
заменить на это
Код:
if TreeViewStyle or TVStyle then
begin
OnMouseDown := @ComponentsListOnMouseDown;
OnItemMouseMove := @ComponentsListOnItemMouseMove;
end;
то заработает.
TVStyle неизвестное значение при компиляции. инно 5.5.1 юникод
 

sergey3695

Ветеран
Модератор
justdj, что-то кроме как вручную прописывать не знаю
Код:
    with WizardForm.ComponentsList do
    begin
      if Checked[0] and Checked[1] and Checked[2] and Checked[4] then
          WizardForm.TypesCombo.ItemIndex:= 0
      else
          WizardForm.TypesCombo.ItemIndex:= 1;
    end;
Код:
[setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\1
ComponentsListTVStyle=true

[Languages]
Name: "rus"; MessagesFile: "compiler:Languages\Russian.isl"

[Types]
Name: full; Description: Полная установка
Name: custom; Description: Выборочная установка; Flags: iscustom

[Components]
Name: a; Description: Моя программа™; Types: full
Name: a\a; Description: Руководство пользователя; Types: full
Name: a\a\a; Description: Русский; Flags: exclusive
Name: a\a\b; Description: English; Flags: exclusive
Name: a\b; Description: Справка; Types: full

[Code]
type
    TCheckListBoxHelper = record
        Index: Integer;
        ItemArea: TItemArea;
    end;

var
   CLBHelper: TCheckListBoxHelper;
   b: tnewchecklistbox;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ComponentsListOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if (Button = mbLeft) and (CLBHelper.ItemArea = iaItem) then
  begin
    with TNewCheckListBox(Sender) do
    begin
      if ItemEnabled[CLBHelper.Index] then
      begin
        case State[CLBHelper.Index] of
          cbUnchecked,
          cbGrayed:
            CheckItem(CLBHelper.Index, coCheckWithChildren);
          cbChecked:
            CheckItem(CLBHelper.Index, coUncheck);
        end;
      end;
    end;
  end;
//
    with WizardForm.ComponentsList do
    begin
      if Checked[0] and Checked[1] and Checked[2] and Checked[4] then
          WizardForm.TypesCombo.ItemIndex:= 0
      else
          WizardForm.TypesCombo.ItemIndex:= 1;
    end;
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ComponentsListOnItemMouseMove(Sender: TObject; X, Y: Integer; Index: Integer; Area: TItemArea);
begin
    CLBHelper.Index := Index;
    CLBHelper.ItemArea := Area;
end;

procedure InitializeWizard;
begin
    with WizardForm.ComponentsList do
    begin
      OnMouseDown := @ComponentsListOnMouseDown;
      OnItemMouseMove := @ComponentsListOnItemMouseMove;
    end;
end;
 

Shegorat

Lord of Madness
Администратор
что-то кроме как вручную прописывать не знаю
Можно добавить вызов обработчика OnClickCheck() после установки состояния элемента
Код:
****
        case State[CLBHelper.Index] of
          cbUnchecked,
          cbGrayed:
            CheckItem(CLBHelper.Index, coCheckWithChildren);
          cbChecked:
            CheckItem(CLBHelper.Index, coUncheck);
        end;

       TNewCheckListBox(Sender).OnClickCheck(Sender);
****
Эта функция выполняет роль обработчика состояний компонентов, и в зависимости от них, устанавливает соответствующее значение TypesCombo
 
Сверху