FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   INNO TROUBLESHOOT - Questions Here (https://fileforums.com/showthread.php?t=93193)

bunti_o4u 19-06-2020 09:07

Loading items in combobox from text file
 
I am trying to load the items in a combobox from a text file but whats it loading is the last line and not all the lines..

Pl help. Thnx in advance..
Code:

var
  S: String;

function GetFileLines(const FileName: string; out Items: string): Boolean;
var
  FileLines: TArrayOfString;
  LineIndex: Integer;
begin
  Result:= LoadStringsFromFile(FileName, FileLines);
  if Result then
    for LineIndex:=0 to (GetArrayLength(FileLines)-1) do
    Items:= FileLines[LineIndex];
end;

  Combobox1:= TComboBox.Create(WizardForm);
  with Combobox1 do
  begin
    Parent:=WizardForm;
    SetBounds(left, Top, Width, Height);
    Style:=csDropDown;
    Color:=clWhite;
    if GetFileLines(ExpandConstant('{src}\Text.ini'), S) then
      Items.Add(S);
  end;


Cesar82 19-06-2020 11:16

Quote:

Originally Posted by bunti_o4u (Post 486436)
I am trying to load the items in a combobox from a text file but whats it loading is the last line and not all the lines..

Pl help. Thnx in advance..
Code:

var
  S: String;

function GetFileLines(const FileName: string; out Items: string): Boolean;
var
  FileLines: TArrayOfString;
  LineIndex: Integer;
begin
  Result:= LoadStringsFromFile(FileName, FileLines);
  if Result then
    for LineIndex:=0 to (GetArrayLength(FileLines)-1) do
    Items:= FileLines[LineIndex];
end;

  Combobox1:= TComboBox.Create(WizardForm);
  with Combobox1 do
  begin
    Parent:=WizardForm;
    SetBounds(left, Top, Width, Height);
    Style:=csDropDown;
    Color:=clWhite;
    if GetFileLines(ExpandConstant('{src}\Text.ini'), S) then
      Items.Add(S);
  end;


TRY:
Code:

procedure GetFileLines(const FileName: string; var Combo: TComboBox);
var
  FileLines: TArrayOfString;
  LineIndex: Integer;
begin
  if  LoadStringsFromFile(FileName, FileLines) then
    for LineIndex := 0 to GetArrayLength(FileLines) - 1 do
      Combo.Items.Add(FileLines[LineIndex]);
end;

  Combobox1:= TComboBox.Create(WizardForm);
  with Combobox1 do
  begin
    Parent := WizardForm;
    SetBounds(left, Top, Width, Height);
    Style := csDropDown;
    Color := clWhite;
    GetFileLines(ExpandConstant('{src}\Text.ini'), Combobox1)
  end;


bunti_o4u 19-06-2020 13:49

Quote:

Originally Posted by Cesar82 (Post 486439)
TRY:

I have done the same but forgot to put var in the procedure
Code:

procedure GetFileLines(const FileName: string; var Combo: TComboBox);
Thank you.. it worked but now I am facing another problem.

I have second Combobox which is dependent on first combobox for its filename. Procedure is generating Combobox1.Items.Text as Line1Line2Line3(...).ini

Pl tell me how to fix it..
Code:

  Combobox2:= TComboBox.Create(WizardForm);
  with Combobox2 do
  begin
    Parent := WizardForm;
    SetBounds(left, Top, Width, Height);
    Style := csDropDown;
    Color := clWhite;
    GetFileLines(ExpandConstant('{src}\'+ ComboBox1.Items.Text +'.ini'), Combobox2)
  end;


Cesar82 19-06-2020 17:39

Quote:

Originally Posted by bunti_o4u (Post 486442)
I have second Combobox which is dependent on first combobox for its filename. Procedure is generating Combobox1.Items.Text as Line1Line2Line3(...).ini

Pl tell me how to fix it..
Code:

  Combobox2:= TComboBox.Create(WizardForm);
  with Combobox2 do
  begin
    Parent := WizardForm;
    SetBounds(left, Top, Width, Height);
    Style := csDropDown;
    Color := clWhite;
    GetFileLines(ExpandConstant('{src}\'+ ComboBox1.Items.Text +'.ini'), Combobox2)
  end;


TRY
Code:

var
  I: Integer

  Combobox2:= TComboBox.Create(WizardForm);
  with Combobox2 do
  begin
    Parent := WizardForm;
    SetBounds(left, Top, Width, Height);
    Style := csDropDown;
    Color := clWhite;
    for I := 0 to Combobox1.Items.Count - 1 do
      GetFileLines(ExpandConstant('{src}\' + ComboBox1.Items.Strings[I]), Combobox2)
  end;


bunti_o4u 20-06-2020 01:54

1 Attachment(s)
Quote:

Originally Posted by Cesar82 (Post 486444)
TRY

Thank you for helping me out..

This code didn't work.. I am trying something else and I don't know whether it would fix it or not..

Pl have a look at the attached script..

Cesar82 20-06-2020 07:22

1 Attachment(s)
Quote:

Originally Posted by bunti_o4u (Post 486448)
Thank you for helping me out..

This code didn't work.. I am trying something else and I don't know whether it would fix it or not..

Pl have a look at the attached script..

Try attached file.
I added 2 modes. (I commented on the mode with external functions)

bunti_o4u 20-06-2020 08:52

Quote:

Originally Posted by Cesar82 (Post 486453)
Try attached file.
I added 2 modes. (I commented on the mode with external functions)

Thank you very much..

it's working smooth as butter..

Cesar82 20-06-2020 09:55

1 Attachment(s)
Hey guys.

Can someone help me with a problem.
I was wondering if you have a way to convert hexadecimal Cyrillic characters (string) to a string using only inno setup functions or just the windows API without including additional libraries.
Summing up: I would like to convert: C := Chr($05E2);

I attached a file with a function that uses this, but I can't get it to work without including an additional library (I don't want to use Libs)
If some of the more knowledgeable users can help me, thank you in advance.
Please look at the attached code.

Razor12911 21-06-2020 03:24

Quote:

Originally Posted by Cesar82 (Post 486455)
Hey guys.

Can someone help me with a problem.
I was wondering if you have a way to convert hexadecimal Cyrillic characters (string) to a string using only inno setup functions or just the windows API without including additional libraries.
Summing up: I would like to convert: C := Chr($05E2);

I attached a file with a function that uses this, but I can't get it to work without including an additional library (I don't want to use Libs)
If some of the more knowledgeable users can help me, thank you in advance.
Please look at the attached code.

$05E2 is not Cyrillic, it's Hebrew
Chr accepts byte value and returns ASCII value, $0532 is a Word value
You must use #$???? For UTF-8 format, example C := #$05E2

Cesar82 21-06-2020 05:58

Quote:

Originally Posted by Razor12911 (Post 486464)
$05E2 is not Cyrillic, it's Hebrew
Chr accepts byte value and returns ASCII value, $0532 is a Word value
You must use #$???? For UTF-8 format, example C := #$05E2

Yes, I ended up putting the non-Cyrillic example, but it has the same meaning.
They are Word values.
I know that chr only supports Byte and these type of characters are word type.
But as in the script example, I need to convert a hexadecimal string read from the inno setup language file and convert it to a string (text).

Code:

S1 := '<0420><0443><0441><0441><043A><0438><0439>';
From this string above I need to return: "Русский"
I want to do this using only API or in the script itself if there is im way to do this without external DLL.
Please take a look at the script.

bunti_o4u 21-06-2020 11:37

1 Attachment(s)
Quote:

Originally Posted by Cesar82 (Post 486469)
Code:

S1 := '<0420><0443><0441><0441><043A><0438><0439>';
From this string above I need to return: "Русский"

I hope you want this...

BTW if you are on discord pl add me (discord id: buntionly4u#4466)
Code:

function InitializeSetup(): Boolean;
var
  S1, S2: String;
begin
  S1 := #$0420+#$0443+#$0441+#$0441+#$043A+#$0438+#$0439;
  MsgBox(S1, mbInformation, MB_OK);
end;


Cesar82 21-06-2020 12:51

Quote:

Originally Posted by bunti_o4u (Post 486473)
I hope you want this...

BTW if you are on discord pl add me (discord id: buntionly4u#4466)
Code:

function InitializeSetup(): Boolean;
var
  S1, S2: String;
begin
  S1 := #$0420+#$0443+#$0441+#$0441+#$043A+#$0438+#$0439;
  MsgBox(S1, mbInformation, MB_OK);
end;


Thanks for responding, but it's not that simple.
I get the string using the ISPP by calling the ReadIni function.
Check the Russian.isl language language of Inno Setup and try to read the key LanguageName= using GetIniString and try to transform it into text as in your message.
Download the ChrW script that you will understand.

KaktoR 22-06-2020 05:27

Hey guys&girls :p

I'm looking for a char (preferably) or icon (max 14x14px) to display free/need space, which can be understand in any language (or at least most).

Anyone have ideas?

I already had looked through windows charmap but can't find anything usefull.

bunti_o4u 22-06-2020 12:15

If we want to run any task during installation we can use below command which run the task or other program in a separate window:
Code:

function Exec(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean;
I just want to know - can we add console within wizard page instead of separate windows to show console details to user.

If yes then pl tell how to do it..

Thanks in advance..

DiCaPrIo 22-06-2020 13:25

Quote:

Originally Posted by bunti_o4u (Post 486490)
If we want to run any task during installation we can use below command which run the task or other program in a separate window:
Code:

function Exec(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean;
I just want to know - can we add console within wizard page instead of separate windows to show console details to user.

If yes then pl tell how to do it..

Thanks in advance..

here
download ISutils and got the CaptureConsole.iss
https://www.fileforums.com/showthread.php?t=99835


All times are GMT -7. The time now is 09:14.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com