Image File

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

Tudorf
Posts: 50
Joined: Wed Feb 08, 2023 3:43 pm

Image File

Post by Tudorf »

Hallo

Ich hatte unter VO mit dem Image-Editor diverse Icons erstellt und im bBrowser dargestellt.

Code: Select all

CLASS logo_zuordnung INHERIT Icon

CONSTRUCTOR(kLoadoption, iWidth, iHeight) 
	SUPER(ResourceID{"logo_zuordnung", _GetInst()},kLoadoption, iWidth, iHeight)
RETURN SELF

END CLASS


Der Aufruf mit einem ICONASTERISK funktioniert.

Code: Select all

				oImage1 := bIcon{ ResourceID{ "logo_zuordnung",_GetInst()} }
				oImage1:Size := Dimension{16, 16}
				oImage2 := bIcon{ ResourceID{ "logo_zuordnung",_GetInst()} }
				oImage2:Size := Dimension{16, 16}                   
				                                    
oImage1 := bIcon{ICONASTERISK}
oImage2 := bIcon{ICONASTERISK}
						
				oBColumn := bDataColumn{SELF:_aTabPages[1]:bBrowser_BF_Verw, _odbBF_verw,{|server, oImage1, oImage2| iif(server:RECNO > 1, oImage1, oImage2)} , #EXPRESSION, oImage1, oImage2}
				oBColumn:caption := "Zuordnung"
				oBColumn:Width := 35				
				oBColumn:Alignment := BALIGN_CENTER
Wahrscheinlich liegen die Daten an der falschen Stelle bzw. er findet sie nicht.
Oder ich muss die *.ICO irgendwo zuweisen.

Martin
User avatar
Chris
Posts: 5630
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Image File

Post by Chris »

Hi Martin,

You did not mention what the problem is. Do you get an error when compiling or when running? What is the full error message?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Tudorf
Posts: 50
Joined: Wed Feb 08, 2023 3:43 pm

Re: Image File

Post by Tudorf »

Hallo Chris

Es gibt keinen Fehler. X# gibt nur nichts aus.

Hier mein VO Programm.
Screenshot 2025-02-25 093607.jpg
Hier X#. Links habe ich bIcon{ICONASTERISK} zugewiesen. Das icon ist ja in der VOGUIclasses definiert. Der Aufruf schein, für mich, ok zu sein. Ich wermute dass meine Icon leer bzw. nicht definiert sind.
Screenshot 2025-02-25 093739.jpg
Martin
User avatar
robert
Posts: 5041
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Image File

Post by robert »

Martin,

Does your project contain a .RC file that includes the logo_zuordnung.ico?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
ArneOrtlinghaus
Posts: 495
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Re: Image File

Post by ArneOrtlinghaus »

Hallo Martin,
wenn du den Kode mit den Icons in eine DLL ausgelagert hast und dann mit dem Standard-Iconobjekt BIcon mit Parameter _GetInst() aufrufste,
dann ist _GetInst() nicht die Instanz mit den Ressourcen, sondern die vom Aufrufer. Die Instanz von der Dll ist nicht so einfach herauszubekommen ohne Aufruf dieser Funktion in der korrekten Dll.

Am sichersten ist es, wenn man in der DLL mit den Icon-Ressourcen für jede Ressource eine eigene abgeleitetete Icon-Klasse macht.
Diese Icons kann man dann ohne Parameter im Constructor erzeugen.

Ob ein Icon richtig funktioniert, kann man auch das Icon erzeugen und dem Shell-Objekt Winshell:Icon := oIcon
zuweisen. Damit ist man unabhängig von der Darstellung im Browser, die auch möglicherweise nicht funktioniert.
Wenn die Applikation das richtige Icon in der Statusbar anzeigt, dann funktioniert das Icon.

Arne
User avatar
Chris
Posts: 5630
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Image File

Post by Chris »

Hi Martin,

Based on what Arne said, I got another idea, please right click on your main app (BS_V4), select from the context menu Add Existing->Add Native Resources and choose the file BmpApp.rc from your library (BS_Util_V4) folder. If you get any compiling errors, you will need to copy also the bitmaps and icons from the library's \Resources folder, to the app's \Resources folder.

This will cause the resources to be embedded also in the main .exe, so loading them with _GetInst() should work. The difference to the VO version of the program, is that VO embeds libraries (code and resources) inside the main .exe, while in X# libraries are output as separate .dll files.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Tudorf
Posts: 50
Joined: Wed Feb 08, 2023 3:43 pm

Re: Image File

Post by Tudorf »

Hallo

Dem Shellwindow habe ich es zugewiesen. Es wird nicht angezeigt.
Ein oWin:Icon := Icon{ICONASTERISK} funktioniert.
Screenshot 2025-02-25 140804.jpg
Die RC-Datei habe ich meinem Hauptprogramm hinzugefügt.
Ebenso die Class Definitionen der Icon

Mir ist nicht klar was die beiden Backslash "\\" in der RC-Datei bedeuten. Sorry.

Code: Select all

kogo_bestell Icon "Resources\\logo_bestell.ico"
logo_anzeige Icon "Resources\\logo_bestell.ico"
logo_bestell Icon "Resources\\logo_bestell.ico"
logo_lager Icon "Resources\\logo_Lager.ico"
logo_show Icon "Resources\\logo_show.ico"
logo_test Icon "Resources\\logo_test.ico"
logo_zuordnung Icon "Resources\\logo_Zuordnung.ico"
Die BmpApp.rc habe ich in verschiedene Verzeichnisse kopiert. Auch in mein Ausgabeverzeichnis
Screenshot 2025-02-25 141909.jpg
Ich habe einem Pushbutton ein Icon über dem Designer zugewiesen. Dort wird nichts angezeigt. Einem anderen Button habe ich ein Icon vom ReportPro zugewiesen. Das funktioniert.
Screenshot 2025-02-25 142308.jpg
Die ICO-Dateien habe ich ebenfalls in diverse Verzeichnisse kopiert.
Screenshot 2025-02-25 142533.jpg
Martin
User avatar
Chris
Posts: 5630
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Image File

Post by Chris »

Hi Martin,

I just tried to use in your project for the shell window:

oWin:Icon := logo_zuordnung{}

And this works fine here, even if I keep the resources in the dll! The icon appears as expected in the shell window. (But I used an icon of mine)

Can you please completely zip your project folder (not the XIDE export file, as this will miss some necessary external files) and upload it to dropbox or similar, where I can download it from and have a look? Please don't send by email, as this will be very big and email checkers will not allow dlls etc inside it.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
FFF
Posts: 1743
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Re: Image File

Post by FFF »

I' d think, there's a problem with his icon, as it seems to work with your owns and for him with RP ones or windows ones...
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
Chris
Posts: 5630
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Image File

Post by Chris »

Hi Karl,

I also suspected that, but the icons are fine, turns out it was a problem with icorrect place of resource files (.rc) and bitmap/icon files.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply