How to change the text size in the toc_folder using XPCE?

Hi, everybody.
I’m working with the pce_toc library, however when creating a directory-hierarchy the font size that is shown on the window is very small, How can I increase the font size in both files and directories?.
I have tried to change these lines of code but I get no results.

        get(SubDirsNames, map, ?(D, directory, @arg1), SubDirs),
        send(SubDirs, for_all, message(FB, son, D, create(toc_folder, @arg1?name, @arg1))),
        get(FileNames, map, ?(D, file, @arg1), SubFiles),
        send(SubFiles, for_all, message(FB, son, D, create(toc_file, @arg1?base_name, @arg1)))

This is the complete code:

:- use_module(library(pce)).
:- pce_autoload(toc_window, library(pce_toc)).
:- pce_autoload(report_dialog, library(pce_report)).
:- pce_begin_class(explorer, frame, "Explore the filesystem").

initialise(E, Dir:directory) :->
        "Explore from directory"::
        send_super(E, initialise, 'Explorador de Archivos'),
        send(E, append, new(DH, directory_hierarchy(Dir))),
        send(DH, size, size(800, 600)),
        send(new(report_dialog), below, DH).


open_node_final(_,Node:file) :->
        "Show file content of opened node"::  
        retractall(selected_file(_)),
        write(Node),
        new(I,image(Node)),
        new(Bitmap,bitmap(I)),
        % Prueba de dialogo
        new(G,dialog('Nombre del Dialogo')),
        % Dos botones
        new(Desplegable,menu(segmentacion,cycle)),
        new(Button1,button('Realizar operación',
        					message(@prolog,guardar_imagen,Node,Desplegable?selection))),

        new(@boton_aux, button('Cerrar Dialogo',
				and(
					message(G,destroy),
					message(G,free),
					message(@boton_aux, free)))),
        send_list(Desplegable,append,[bordes,umbral,regiones]),
        send(G,display,Bitmap),
        send(G,append(Desplegable)),
        send(G,append(Button1)),
        send(G,append(@boton_aux)),
        send(G,open).
        
guardar_imagen(Node,Menus) :- assertz(selected_file(Node)),
                                write(Menus).


:- pce_end_class.
% -------------------------------------------------
% Clase de la jerarquía de directorios
% -------------------------------------------------
:- pce_begin_class(directory_hierarchy, toc_window,
                   "Browser for a directory-hierarchy").

initialise(FB, Root:directory) :->
        send(FB, send_super, initialise),
        get(Root, name, Name),
        send(FB, root, toc_folder(Name, Root)).

expand_node(FB, D:directory) :->
        "Called if a node is to be expanded"::
        new(SubDirsNames, chain),
        new(FileNames, chain),
        send(D, scan, FileNames, SubDirsNames),
        get(SubDirsNames, map, ?(D, directory, @arg1), SubDirs),
        send(SubDirs, for_all, message(FB, son, D, create(toc_folder, @arg1?name, @arg1))),
        get(FileNames, map, ?(D, file, @arg1), SubFiles),
        send(SubFiles, for_all, message(FB, son, D, create(toc_file, @arg1?base_name, @arg1))).
	
open_node(FB, Node:file) :->
        "Called if a file is double-clicked"::
        send(FB?frame, open_node_final, Node).

:- pce_end_class.

from the guide, seems that you could try to send font changing messages to the objects toc_file and toc_folder… before delving into this, please wait for hints from more knowledgeable people… I’m unsure it’s the proper way.
What I would do, instead, is first try to change the global XPCE font size: open ‘Settings \ GUI preferences…’ from the (windows) console menu, and uncomment the last line, changing the default to 1.5.

My Windows 10 works fine, no font problems, from you source:

?- new(D,directory_hierarchy(.)).
D = @342833116757/directory_hierarchy.

?-  in_pce_thread(send( $D,show,true)).
D = @342833116757/directory_hierarchy.

PasiK is definitey the XPCE expert of this group :sweat_smile:

1 Like