Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для Dodakaedr

Ветеран


Сообщения: 857
Благодарности: 256

Профиль | Отправить PM | Цитировать


Вложения
Тип файла: rar Файлы.rar
(29.3 Kb, 22 просмотров)

Цитата diman_21Ru:
А если уже есть картинки на модах,можно лишь только на текст скрипт а то можно запутаться там у меня ) »
Как-то так:
читать дальше »
Код: Выделить весь код
[Setup]
AppName=Моя программа
AppVersion=1.5
DefaultDirName={pf}\Моя программа

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

[CustomMessages]
RU.CompName1=Компонент 1
RU.CompName2=Компонент 2
RU.ComponentsInfo=Наведите курсор мыши на компонент, чтобы прочитать его описание.
RU.CompDesc1=Описание первого компонента
RU.CompDesc2=Описание второго компонента

[Types]
Name: full; Description: Full installation; Flags: iscustom

[Components]
Name: comp1; Description: "{cm:CompName1}"; Types: full
Name: comp2; Description: "{cm:CompName2}"; Types: full

[ Code]
type
  TComponentDesc = record
    Description: String;
    Index: Integer;
  end;

var
  CompDescs: array of TComponentDesc;
  CompDescPanel: TPanel;
  CompDescText: array[1..2] of TLabel;
  CompIndex, LastIndex: Integer;
  

procedure ShowCompDescription(Sender: TObject; X, Y, Index: Integer; Area: TItemArea);
var
  i: Integer;
begin
  if Index = LastIndex then Exit;
  CompIndex := -1;
  for i := 0 to GetArrayLength(CompDescs) -1 do
  begin
    if (CompDescs[i].Index = Index) then
    begin
      CompIndex := i;
      Break;
    end;
end;
  if (CompIndex >= 0) and (Area = iaItem) then
  begin
    CompDescText[2].Caption := CompDescs[CompIndex].Description;
    CompDescText[2].Enabled := True;
  end else
  begin
    CompDescText[2].Caption := CustomMessage('ComponentsInfo');
    CompDescText[2].Enabled := False;
  end;
  LastIndex := Index;
end;

procedure CompListMouseLeave(Sender: TObject);
begin
  CompDescText[2].Caption := CustomMessage('ComponentsInfo');
  CompDescText[2].Enabled := False;
  LastIndex := -1;
end;

procedure AddCompDescription(AIndex: Integer; ADescription: String; AImageName: String);
var
  i: Integer;
begin
  i := GetArrayLength(CompDescs);
  SetArrayLength(CompDescs, i + 1);
  CompDescs[i].Description := ADescription;
  CompDescs[i].Index := AIndex - 1
end;

procedure InitializeWizard();
begin
  WizardForm.SelectComponentsLabel.Hide;
   WizardForm.ComponentsList.SetBounds(ScaleX(0), ScaleY(0), ScaleX(184), ScaleY(205));
  WizardForm.ComponentsList.OnItemMouseMove:= @ShowCompDescription;
  WizardForm.ComponentsList.OnMouseLeave := @CompListMouseLeave;

  CompDescPanel := TPanel.Create(WizardForm);
  with CompDescPanel do
  begin
    Parent := WizardForm.SelectComponentsPage;
    SetBounds(ScaleX(192), ScaleY(125), ScaleX(225), ScaleY(80));
    BevelInner := bvLowered;
  end;

  CompDescText[2] := TLabel.Create(WizardForm);
  with CompDescText[2] do
  begin
    Parent := CompDescPanel;
    SetBounds(ScaleX(5), ScaleY(5), CompDescPanel.Width - ScaleX(10), CompDescPanel.Height - ScaleY(10));
    AutoSize := False;
    WordWrap := True;
    Enabled := False;
    Caption := CustomMessage('ComponentsInfo');
  end;

  AddCompDescription(1, CustomMessage('CompDesc1'), 'False');
  AddCompDescription(2, CustomMessage('CompDesc2'), 'False');
  end;


Цитата Kashtan007:
Возможно ли сделать так, чтобы изначально там стола картинка, а уже при наведении на компонент она заменялась на картинку компонента.
Пробовал ставить через редактор форм (BitmapImage), но тогда картинку просто закрывает, окно для картинок компонентов.
Есть какой-то другой способ? »
Вот так:
читать дальше »
Код: Выделить весь код
[Setup]
AppName=Моя программа
AppVersion=1.5
DefaultDirName={pf}\Моя программа

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

[CustomMessages]
RU.CompName1=Компонент 1
RU.CompName2=Компонент 2
RU.ComponentsInfo=Наведите курсор мыши на компонент, чтобы прочитать его описание.
RU.CompDesc1=Описание первого компонента
RU.CompDesc2=Описание второго компонента

[Files]
Source: "WizModernImage.bmp"; DestName: "CompDescImg1.bmp"; Flags: dontcopy
Source: "WizModernImage-IS.bmp"; DestName: "CompDescImg2.bmp"; Flags: dontcopy
Source: "11.bmp"; DestName: "CompDescImg3.bmp"; Flags: dontcopy

[Types]
Name: full; Description: Full installation; Flags: iscustom

[Components]
Name: comp1; Description: "{cm:CompName1}"; Types: full
Name: comp2; Description: "{cm:CompName2}"; Types: full

[ Code]
type
  TComponentDesc = record
    Description: String;
    ImageName: String;
    Index: Integer;
  end;

var
  CompDescs: array of TComponentDesc;
  CompDescPanel, CompDescImgPanel: TPanel;
  CompDescText: TLabel;
  CompIndex, LastIndex: Integer;
  CompDescImg, BitmapImage: TBitmapImage;

procedure ShowCompDescription(Sender: TObject; X, Y, Index: Integer; Area: TItemArea);
var
  i: Integer;
begin
  if Index = LastIndex then Exit;
  CompIndex := -1;
  for i := 0 to GetArrayLength(CompDescs) -1 do
  begin
    if (CompDescs[i].Index = Index) then
    begin
      CompIndex := i;
      Break;
    end;
  end;
  if (CompIndex >= 0) and (Area = iaItem) then
  begin
    if not FileExists(ExpandConstant('{tmp}\') + CompDescs[CompIndex].ImageName) then
      ExtractTemporaryFile(CompDescs[CompIndex].ImageName);
    CompDescImg.Bitmap.LoadFromFile(ExpandConstant('{tmp}\') + CompDescs[CompIndex].ImageName);
    CompDescImg.Show;
    BitmapImage.Hide;
    CompDescText.Caption := CompDescs[CompIndex].Description;
    CompDescText.Enabled := True;
    end else
  begin
    CompDescText.Caption := CustomMessage('ComponentsInfo');
    CompDescText.Enabled := False;
    CompDescImg.Hide;
    BitmapImage.Show;
    end;
  LastIndex := Index;
  
end;

procedure CompListMouseLeave(Sender: TObject);
begin
  CompDescImg.Hide;
  CompDescText.Caption := CustomMessage('ComponentsInfo');
  CompDescText.Enabled := False;
  LastIndex := -1;
  BitmapImage.Show;
end;

procedure AddCompDescription(AIndex: Integer; ADescription: String; AImageName: String);
var
  i: Integer;
begin
  i := GetArrayLength(CompDescs);
  SetArrayLength(CompDescs, i + 1);
  CompDescs[i].Description := ADescription;
  CompDescs[i].ImageName := AImageName;
  CompDescs[i].Index := AIndex - 1
end;

procedure InitializeWizard();
begin
  WizardForm.SelectComponentsLabel.Hide;
  WizardForm.TypesCombo.Hide;
  WizardForm.ComponentsList.SetBounds(ScaleX(0), ScaleY(0), ScaleX(184), ScaleY(205));
  WizardForm.ComponentsList.OnItemMouseMove:= @ShowCompDescription;
  WizardForm.ComponentsList.OnMouseLeave := @CompListMouseLeave;

  CompDescImgPanel := TPanel.Create(WizardForm);
  with CompDescImgPanel do
  begin
    Parent := WizardForm.SelectComponentsPage;
    SetBounds(ScaleX(192), ScaleY(0), ScaleX(225), ScaleY(120));
    BevelInner := bvLowered;
    end;

   BitmapImage := TBitmapImage.Create(WizardForm);
  with BitmapImage do
  begin
    Parent := CompDescImgPanel;
    SetBounds(ScaleX(5), ScaleY(5), CompDescImgPanel.Width - ScaleX(10), CompDescImgPanel.Height - ScaleY(10));
    ExtractTemporaryFile('CompDescImg3.bmp');
   Bitmap.LoadFromFile(ExpandConstant('{tmp}\CompDescImg3.bmp'));
  end;

  CompDescImg := TBitmapImage.Create(WizardForm);
  with CompDescImg do
  begin
    Parent := CompDescImgPanel;
    SetBounds(ScaleX(5), ScaleY(5), CompDescImgPanel.Width - ScaleX(10), CompDescImgPanel.Height - ScaleY(10));
    Stretch := True;
    Hide;
  end;

  CompDescPanel := TPanel.Create(WizardForm);
  with CompDescPanel do
  begin
    Parent := WizardForm.SelectComponentsPage;
    SetBounds(ScaleX(192), ScaleY(125), ScaleX(225), ScaleY(80));
    BevelInner := bvLowered;
  end;

  CompDescText := TLabel.Create(WizardForm);
  with CompDescText do
  begin
    Parent := CompDescPanel;
    SetBounds(ScaleX(5), ScaleY(5), CompDescPanel.Width - ScaleX(10), CompDescPanel.Height - ScaleY(10));
    AutoSize := False;
    WordWrap := True;
    Enabled := False;
    Caption := CustomMessage('ComponentsInfo');
  end;

  AddCompDescription(1, CustomMessage('CompDesc1'), 'CompDescImg1.bmp');
  AddCompDescription(2, CustomMessage('CompDesc2'), 'CompDescImg2.bmp');
  end;

-------
Inno Setup 5 Ultra Unicode


Последний раз редактировалось Dodakaedr, 21-05-2014 в 13:26.

Это сообщение посчитали полезным следующие участники:

Отправлено: 12:33, 21-05-2014 | #715