How to change label in gtkada and glade - ada

I am having a trouble with set_text to change the label when I clicked the button
error:
Builder results
C:\Users\MaxPayne\Desktop\Ada workspace\Gui3\src\window_play.adb
42:16 expected an access type with designated type "Gtk_Label_Record" defined at gtk-label.ads:189
42:16 found package or procedure name
The error in the line: Set_Text (Label, "The button clicks:" & Natural'Image (Count));
This is the sample code: of simple_glade3.adb
with Gtk; use Gtk;
with Gtk.Main; use Gtk.Main;
with Gtk.Widget; use Gtk.Widget;
with Gtkada.Builder; use Gtkada.Builder;
-- the following package is user defined.
with Simple_Callbacks; use Simple_Callbacks;
with Window_Play; use Window_Play;
with Gtk.Builder; use Gtk.Builder;
with Gtk.Window; use Gtk.Window;
with Gtk.Button; use Gtk.Button;
with Gtkada.Handlers; use Gtkada.Handlers;
use Gtkada.Handlers;
with Glib; use Glib;
with Glib.Error; use Glib.Error;
with Gtk.Main;
with Gtk.Label; use Gtk.Label;
with Gtk.Frame; use Gtk.Frame;
with ada.Text_IO; use ada.Text_IO;
procedure Simple_Glade3 is
Builder : Gtkada_Builder;
error : aliased GError;
Win : Gtk_Window;
ret : GUint;
Button : Gtk_Button;
begin
Gtk.Main.Init;
Gtk_New (Builder);
ret := Builder.Add_From_File ("welcomemenu.glade", error'Access);
Register_Handler
(Builder => Builder,
Handler_Name => "Main_Quit", -- from XML file <signal handler=..>
Handler => Simple_Callbacks.Quit'Access);
Do_Connect (Builder);
button := Gtk_Button (Builder.Get_Object ("btn_play"));
button.On_Clicked (changeLabel'Access);
Win := Gtk_Window (Builder.Get_Object ("win_main"));
Win.Show_All;
Gtk.Main.Main;
Ada.Text_IO.Put_Line ("The demo is over");
Unref (Builder);
end Simple_Glade3;
window_play.ads
with Gtkada.Builder; use Gtkada.Builder;
with Gtk.Main;
with Gtk.Button; use Gtk.Button;
package Window_Play is
procedure Quit (Object : access Gtkada_Builder_Record'Class);
procedure changeLabel (Self : access Gtk_Button_Record'Class);
end Window_Play;
window_play.adb
with Gtk; use Gtk;
with Gtk.Main; use Gtk.Main;
with Glib.Error; use Glib.Error;
with Gtk.Widget; use Gtk.Widget;
with Ada.Text_IO;
with Gtkada.Builder; use Gtkada.Builder;
-- the following package is user defined.
with Simple_Callbacks; use Simple_Callbacks;
with Gtk.Builder; use Gtk.Builder;
with Gtk.Window; use Gtk.Window;
with Gtk.Button; use Gtk.Button;
with Gtkada.Handlers; use Gtkada.Handlers;
with Glib; use Glib;
with Glib.Error; use Glib.Error;
with Gtk.Main;
with Ada.Text_IO; use Ada.Text_IO;
with Gtk.Label; use Gtk.Label;
package body Window_Play is
Builder : Gtkada_Builder;
error : aliased GError;
Win : Gtk_Window;
ret : GUint;
Button : Gtk_Button;
Count : Natural := 0;
procedure Quit (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced (Object);
begin
Gtk.Main.Main_Quit;
end Quit;
procedure changeLabel (Self : access Gtk_Button_Record'Class) is
begin
Count := Count + 1;
Set_Text (Label, "The button clicks:" & Natural'Image (Count));
end changeLabel;
end Window_Play;

As Simon pointed out, the compiler does not see a variable named Label at line 42. Instead it sees the package Gtk.Label and guesses this is what you are referencing.
Assuming your intent is to change what the button displays,you should simply use
Self.Set_Label ("The button clicks:" & Count'Img);

Related

signals with GtkAda

My concern is that I created a callback function, which should display a Gtk_Entry when we click on the Gtk_Button but is that when I click on the button nothing happens. I don't understand.
File.ads
Package Test is
Type T_Test is record
Conteneur : Gtk_Fixe;
L_Entree : Gtk_Entry;
end Record;
Procedure Le_Callback (Emetteur : access Gtk_Button_Record'Class);
Package P is new Gtk.Handlers.Callback (Gtk_Button_Record);
Use P;
end Test;
File.adb
Package body Test is
Procedure Initialise_Conteneur (Object : T_Test) is
begin
Gtk_New (Object.Conteneur);
end Initialise_Conteneur;
Procedure Le_Callback (Emetteur : access Gtk_Button_Record'Classs) is
V : T_Test;
begin
Initialise_Conteneur (Object => V);
Gtk_New (V.L_Entree);
V.Conteneur.Add (V.L_Entree);
V.L_Entree.Show;
end Le_Callback;
end Test;
Main.adb
Procedure Main is
Win : Gtk_Window;
Button : Gtk_Button;
Posix : T_Test;
begin
Init;
Initialize (object => Posix);
1
Gtk_New (Win);
Win.Set_Default_Size (600,400);
Gtk_New (Button,"Bouton");
Test.P.Connect (Widget => Button,
Name => Signal_Clicked,
Marsh => P.To_Marshaller (Le_Test'Access),
After => true);
Posix.Conteneur.Add (Button);
Win.Add (Posix.Conteneur);
Win.Show_All;
Main;
end Main;
Revised answer.
Slightly hacked package ... to export the Initialize method called in Main. (I'm also adding a Button instead of an Entry to make my life simpler)
with Gtk; use Gtk;
with Gtk.Button; use Gtk.Button;
with Gtk.Handlers; use Gtk.Handlers;
with Gtk.Fixed; use Gtk.Fixed;
Package Test is
Type T_Test is record
Conteneur : Gtk_Fixed;
Bouton : Gtk_Button;
end Record;
procedure Initialize (Object : out T_Test);
Procedure Le_Callback (Emetteur : access Gtk_Button_Record'Class);
Package P is new Gtk.Handlers.Callback (Gtk_Button_Record);
Use P;
end Test;
Several issues in the package body...
The parameter passing mode in the Initialize functions.
Make sure the new visible object is in a different place than the old one ... (noting that GTK_Fixed is a harder container to use than the others, in terms of manual layout
The callback creates a new container (now with a button in it) ... but until the container belongs to something, it cannot be displayed. The main window isn't directly visible in this package, so I added it to the parent container of the button that emitted the signal. (There are ways of passing user data to the handler; you could use that to pass in teh top level window or some other container)
And of course we must display the modifications, so let's just redraw the top level window.
(junk text to fix markup issue)
Package body Test is
Procedure Initialise_Conteneur (Object : out T_Test) is
begin
Gtk_New (Object.Conteneur);
end Initialise_Conteneur;
procedure Initialize (Object : out T_Test) renames Initialise_Conteneur;
Procedure Le_Callback (Emetteur : access Gtk_Button_Record'Class) is
V : T_Test;
begin
Initialise_Conteneur (Object => V);
Gtk_New (V.Bouton,"Autre_Bouton");
V.Conteneur.Add (V.Bouton);
-- make sure it doesn't sit on the other button...
-- Using gtk.fixed is hard work compared to newer containers
V.Conteneur.Move(V.Bouton,0,35);
-- Add our new GTK_Fixed container to the outer one
-- note Get_Parent returns a GTK_Widget'Class so we must
-- view convert to a GTK_Container or GTK_Fixed to see the Add method
Gtk_Fixed(Emetteur.Get_Parent).Add(V.Conteneur);
-- And re-display the top level window
Emetteur.Get_Toplevel.Show_All;
end Le_Callback;
end Test;
And the main program (connecting Le_Callback, not the nonexistent Le_Test)...
with Gtk.Button; use Gtk.Button;
with Gtk.Window; use Gtk.Window;
with Gtk.Main;
with test; use test;
Procedure Main is
Win : Gtk_Window;
Button : Gtk_Button;
Posix : T_Test;
begin
Gtk.Main.Init;
Initialize (object => Posix);
Gtk_New (Win);
Win.Set_Default_Size (600,400);
Gtk_New (Button,"Bouton");
Test.P.Connect (Widget => Button,
Name => Signal_Clicked,
Marsh => P.To_Marshaller (Le_Callback'Access),
After => true);
Posix.Conteneur.Add (Button);
Win.Add (Posix.Conteneur);
Win.Show_All;
GTK.Main.Main;
end Main;
and my GPR file for it.
with "gtkada";
-- with "gtkada_gl";
project Test is
for Main use ("main.adb");
for Source_Dirs use (".");
for Object_Dir use "obj";
for Exec_Dir use ".";
package Compiler is
for Default_Switches ("Ada") use ("-g", "-O1", "-gnatafo");
end Compiler;
package Binder is
for Default_Switches ("Ada") use ("-E");
end Binder;
package Linker is
-- for Default_Switches ("Ada") use ("-lgtkglada");
end Linker;
end Test;
Now it builds (in future, PLEASE make the example code buildable! would have saved a good chunk of time) and I get to see a button...
Press the button and the second button appears below it, so we know the handler is connected to the button, and receiving button press messages.
This is more some sort of comment, but this is how would I do it in vala (Compile with valac --pkg=gtk+-3.0 $FILENAME.
int main (string[] args) {
Gtk.init (ref args);
var window = new Gtk.Window ();
window.title = "MyWindow";
window.destroy.connect (Gtk.main_quit);
// Create a box, where we later add the button and then the entry
var box = new Gtk.Box (Gtk.Orientation.VERTICAL, /*spacing*/ 2);
var button = new Gtk.Button.with_label ("Bouton!");
// Connect to the signal "clicked", that is executed, as soon
// as the button is clicked by the user
button.clicked.connect (() => { // () => {...} is your callback.
// Add the entry to the box
box.pack_start (new Gtk.Entry());
// Redraw the window
window.show_all ();
});
// Add the button to the box
box.pack_start (button);
// Add the box to the window
window.add (box);
// Show the main window
window.show_all ();
// GTK-Mainloop
Gtk.main ();
return 0;
}

Can a variable passed with 'address attribute to a procedure be modified?

In my test code below, I am trying to modify a variable by passing it as system.address to another procedure.
with Ada.Text_IO;
with System;
with System.Storage_Elements;
procedure Main is
procedure Modify ( Var : in out System.Address) is
use System.Storage_Elements;
begin
Var := Var + 10;
end Modify;
My_Var : Integer := 10;
begin
-- Insert code here.
Modify (My_Var'Address);
Ada.Text_IO.Put_Line("My_Var is:" & Integer(My_Var)'Image );
end Main;
Compiler is returning an error as below,
17:17 actual for "Var" must be a variable
I could not understand the reason as My_Var(actual for Var) is clearly a variable. What should I change to modify My_Var with system.address?
Note: The context of this trail is that I am trying to understand an interface module in an existing legacy project. While there could be better ways to achieve what I need, I want to understand if it is possible to modify a variable with above method.
It would be helpful if you could show the relevant part of the legacy interface module -- it would help us understand what you need and want to do.
That said, first note that passing a parameter by reference is not usually done in Ada by explicitly passing the 'Address of the actual variable. As you say, there are other and better ways.
If you pass a System.Address value, and then want to read or write whatever data resides at that address, you have to do the read/write through a variable that you force to have that address, or through an access value (the Ada equivalent of "pointer") that you force to point at that addressed location. In both cases, you are responsible for ensuring that the type of the variable, or of the access value, matches the actual type of the data that you want to read or write.
To create an access value that points to memory at a given address, you should use the predefined package System.Address_To_Access_Conversions. That requires some understanding of access values and generics, so I won't show an example here.
To force a variable to have a given address, you declare the variable with the Address aspect set to the given address. The code below shows how that can be done for this example. Note the declaration of the local variable Modify.Var (and note that I changed the name of the parameter from Var to Var_Addr).
with Ada.Text_IO;
with System;
procedure Mod_By_Addr is
procedure Modify (Var_Addr : in System.Address) is
Var : Integer with Address => Var_Addr;
begin
Var := Var + 10;
end Modify;
My_Var : aliased Integer := 10;
begin
Modify (My_Var'Address);
Ada.Text_IO.Put_Line("My_Var is:" & Integer(My_Var)'Image );
end Mod_By_Addr;
Since the Var_Addr parameter is not modified in the Modify procedure, it can be declared with the "in" mode, and so the actual parameter can be an expression (My_Var'Address).
HTH
You modify the address and not the variable. Try to change parameter to Addr : in System.Address and declare Var : Integer with Address => Addr in Modify.
Another way of modifying the variable I have understood using address_to_Access_Conversions is shown below,
with Ada.Text_IO;
with System.Address_To_Access_Conversions;
with System.Storage_Elements;
procedure Main is
procedure Modify ( Var : in System.Address) is
use System.Storage_Elements;
package Convert is new System.Address_To_Access_Conversions (Integer);
begin
Ada.Text_IO.Put_Line(Convert.To_Pointer (Var).all'Img);
end Modify;
My_Var : Integer := 10;
begin
Modify (My_Var'Address);
Ada.Text_IO.Put_Line("My_Var is:" & Integer(My_Var)'Image );
end Main;

Start executable from Ada program and read result

I found this question and the first answer contains some example code demonstrating how to start an executable with Ada code. The output of the executable is written to the standard output.
What options do I have to read the output of the executable for further parsing/processing in Ada (for example line by line)?
If you use GNAT, then you might want to take a look at Get_Command_Output in the GNAT.Expect package. Here's an example:
with Ada.Text_IO, GNAT.Expect;
procedure Main is
Command : constant String := "gnat";
Argument_1 : aliased String := "--version";
Input : constant String := "";
Status : aliased Integer := 0;
-- Execute the command and retrieve the output.
Output : String :=
GNAT.Expect.Get_Command_Output
(Command => Command,
Arguments => (1 => Argument_1'Unchecked_Access),
Input => Input,
Status => Status'Access,
Err_To_Out => False);
-- NOTE: Cheating with Unchecked_Access, OK for demo. You may want
-- to properly new and Free these strings (see Argument_List
-- type in package GNAT.OS_Lib).
begin
Ada.Text_IO.Put_Line (Output);
end Main;
The program returns after execution:
$ ./main
GNAT Community 2019 (20190517-83)
Copyright (C) 1996-2019, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As can be seen, the result is returned as a single string. You will have do the line splitting yourself.
Update
An update in response to some comments below.
You might also consider using the system function if you're targeting the Windows platform (see also this post on SO). Quoting from the function reference:
The system function passes command to the command interpreter, which executes the string as an operating-system command.
This is similar to what the program cmd.exe does. You can obtain the output of the command by redirecting its output to a file (i.e. using >) and then subsequently read it back. Here's an example:
with Ada.Text_IO;
with Ada.Text_IO.Unbounded_IO;
with Ada.Strings.Unbounded;
with Interfaces.C;
with Interfaces.C.Strings;
procedure Main is
use Ada.Strings.Unbounded;
Content : Unbounded_String := Null_Unbounded_String;
begin
-- Execute.
declare
use Interfaces.C;
use Interfaces.C.Strings;
function system (command : chars_ptr) return int
with Import, Convention => C, External_Name => "system";
command : chars_ptr := New_String("gnat --version > gnat_version.out");
result : int := system (command);
begin
-- Check value of result (omitted in this example).
Free(Command);
end;
-- Read.
declare
use Ada.Text_IO;
use Ada.Text_IO.Unbounded_IO;
Fd : File_Type;
begin
Open (Fd, In_File, "./gnat_version.out");
while not End_Of_File (Fd) loop
Content := Content
& Unbounded_String'(Get_Line (Fd))
& ASCII.CR & ASCII.LF; -- Restore the line break removed by Get_Line.
end loop;
Close (fd);
end;
-- Show.
Ada.Text_IO.Unbounded_IO.Put (Content);
end Main;

Ada non-visible declaration error

I am receiving a "non-visible declaration" error on my Generator. I am converting this code from a single procedure to using multiple procedures and functions.
I have truncated the code a bit Any explanation of the non-visible declaration error would be appreciated.
The non visible declaration error is occurring in this block of code:
WITH Ada.Integer_Text_IO;
USE Ada.Integer_Text_IO;
WITH Ada.Text_IO;
USE Ada.Text_IO;
WITH Ada.Strings;
USE Ada.Strings;
WITH Ada.Numerics.Discrete_Random;
PROCEDURE Project IS
SUBTYPE Guess IS Integer RANGE 1 .. 25;
G : Generator;
CorrectAnswer : Guess;
UserGuess : Guess;
BEGIN
Reset (G);
CorrectAnswer := Random(G);
FOR I IN 1..3 LOOP
GetUserGuess(UserGuess);
PrintCorrectAns(CorrectAnswer);
IF IsCorrect(UserGuess) THEN
Put("You Win!");
ELSE
Put("You Lose!");
END IF;
END LOOP;
End Project;
The non-visible declaration at a-nudira.ads:48 and 50 (line numbers may vary with compiler release) are because Ada.Numerics.Discrete_Random, see ARM A.5.2(16), is a generic package and needs to be instantiated with whichever discrete type you need.
In your case, I guess that’s Guess:
package RNG is new Ada.Numerics.Discrete_Random (Result_Subtype => Guess);
use RNG;

QtAda - Drag and drop images from one table view to another

I'm new to programming and just started with Qtada 3.2, so please be indulgent :D
My goal is to drag a picture (png) from one table view model to another.
While the image is already shown during drag in the minimal example below, I guess overriding mouse press and mouse release events should be the solution?
Is there anything else I need to do, like create drop action, mime data or item delegate?
Although I had a look at the QtAda tutorials, I still don't know how to correctly setup overriding events for my table views.
Really tried a lot, but nothing worked. Right now I'm stuck and confused.
It would be nice if somebody could point me to the right direction, or even better, show me a working example!
Bonus question #1: Is there a better / more correct way to load an image into a item model?
Bonus question #2: How to get rid of the line edits in the table? I just need the image to be shown in a cell, nothing else.
Thanks in advance!
Michael
My example:
main.adb
with Qt4.Core_Applications;
with Qt4.Objects;
with Qt4.Push_Buttons.Constructors;
with Qt4.Splitters.Constructors;
with Qt4.Splitters;
with Qt4.Strings;
with Qt_Ada.Application;
with Table_View_Big;
with Table_View_Small;
procedure Main is
begin
Qt_Ada.Application.Initialize;
declare
Quit : constant not null access Qt4.Push_Buttons.Q_Push_Button'Class
:= Qt4.Push_Buttons.Constructors.Create
(Qt4.Strings.From_Utf_16 ("Quit"));
Splitter : constant not null Qt4.Splitters.Q_Splitter_Access
:= Qt4.Splitters.Constructors.Create(The_Orientation => Qt4.Vertical);
Big_Table : constant not null Table_View_Big.Big_Table_Access
:= Table_View_Big.Constructors.Create;
Small_Table : constant not null Table_View_Small.Small_Table_Access
:= Table_View_Small.Constructors.Create;
begin
Splitter.Add_Widget(Big_Table);
Splitter.Add_Widget(Small_Table);
Splitter.Add_Widget(Quit);
Qt4.Objects.Connect (Quit,
Qt4.Signal ("clicked()"),
Qt4.Core_Applications.Instance,
Qt4.Slot ("quit()"));
Splitter.Set_Fixed_Size(640,480);
Splitter.Show;
Qt_Ada.Application.Execute;
end;
end Main;
table_view_small.ads :
with Qt4.Table_Views.Constructors;
with Qt4.Table_Views.Directors;
with Qt4.Abstract_Item_Models;
--with Qt4.Mouse_Events;
package Table_View_Small is
type Small_Table is limited new Qt4.Table_Views.Q_Table_View with private;
type Small_Table_Access is access all Small_Table'Class;
package Constructors is
function Create return not null Small_Table_Access;
end Constructors;
private
type Small_Table is new Qt4.Table_Views.Directors.Q_Table_View_Director with record
Small_Table_Item_Model : Qt4.Abstract_Item_Models.Q_Abstract_Item_Model_Access;
end record;
-- overriding procedure Mouse_Press_Event
-- (Self : not null access Table_Small;
-- Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class);
-- overriding procedure Mouse_Move_Event
-- (Self : not null access Table_Small;
-- Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class);
-- overriding procedure Mouse_Release_Event
-- (Self : not null access Table_Small;
-- Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class);
end Table_View_Small;
table_view_small.adb
with Qt4.Icons;
with Qt4.Model_Indices;
with Qt4.Standard_Item_Models.Constructors;
with Qt4.Strings;
with Qt4.Variants;
with Table_View_Small.MOC;
pragma Warnings (Off, Table_View_Small.MOC);
package body Table_View_Small is
use Qt4;
package body Constructors is
function Create return not null Small_Table_Access is
Self : constant Table_View_Small.Small_Table_Access := new Table_View_Small.Small_Table;
begin
Qt4.Table_Views.Directors.Constructors.Initialize (Self);
declare
Icon : Qt4.Icons.Q_Icon;
Data_Role : Qt4.Item_Data_Role := qt4.Decoration_Role;
Index : Qt4.Model_Indices.Q_Model_Index;
begin
Self.Small_Table_Item_Model := Qt4.Abstract_Item_Models.Q_Abstract_Item_Model_Access
(Qt4.Standard_Item_Models.Constructors.Create (1, 6, Self));
Icon := Qt4.Icons.Create(Qt4.Strings.From_Ucs_4("anypng.png"));
Index := Self.Small_Table_Item_Model.Index(0,0);
Qt4.Abstract_Item_Models.Set_Data(Self.Small_Table_Item_Model,index,icon.To_Q_Variant,Data_Role);
Self.Set_Model(Self.Small_Table_Item_Model);
-- Drag & Drop
Self.Set_Accept_Drops(true);
Self.Set_Drag_Enabled(true);
Self.Set_Drop_Indicator_Shown(true);
-- Self.Set_Drag_Drop_Mode(Qt4.Abstract_Item_Views.Internal_Move);
return Self;
end;
end Create;
end Constructors;
-- overriding procedure Mouse_Press_Event
-- (Self : not null access Small_Table;
-- Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class)
-- is
-- null;
-- end Mouse_Press_Event;
end Table_View_Small;
table_view_big.ads
with Qt4.Table_Views.Constructors;
with Qt4.Table_Views.Directors;
with Qt4.Abstract_Item_Models;
package Table_View_Big is
type Big_Table is limited new Qt4.Table_Views.Q_Table_View with private;
type Big_Table_Access is access all Big_Table'Class;
package Constructors is
function Create return not null Big_Table_Access;
end Constructors;
private
type Big_Table is new Qt4.Table_Views.Directors.Q_Table_View_Director with record
Big_Table_Item_Model : Qt4.Abstract_Item_Models.Q_Abstract_Item_Model_Access;
end record;
-- overriding procedure Mouse_Press_Event
-- (Self : not null access Big_Table;
-- Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class);
--
-- overriding procedure Mouse_Move_Event
-- (Self : not null access Big_Table;
-- Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class);
-- overriding procedure Mouse_Release_Event
-- (Self : not null access Big_Table;
-- Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class);
end Table_View_Big;
table_view_big.adb
with Qt4.Abstract_Item_Views;
with Qt4.Sizes;
with Qt4.Standard_Item_Models.Constructors;
with Table_View_Big.MOC;
pragma Warnings (Off, Table_View_Big.MOC);
package body Table_View_Big is
package body Constructors is
function Create return not null Big_Table_Access is
Self : constant Table_View_Big.Big_Table_Access := new Table_View_Big.Big_Table;
begin
Qt4.Table_Views.Directors.Constructors.Initialize (Self);
declare
begin
Self.Big_Table_Item_Model := Qt4.Abstract_Item_Models.Q_Abstract_Item_Model_Access
(Qt4.Standard_Item_Models.Constructors.Create (25, 25, Self));
Self.Set_Model(Self.Big_Table_Item_Model);
Self.Set_Selection_Mode(Qt4.Abstract_Item_Views.No_Selection);
-- Drag & Drop
Self.Set_Accept_Drops(true);
Self.Set_Drag_Enabled(false);
Self.Set_Drop_Indicator_Shown(true);
-- Self.Set_Drag_Drop_Mode (Qt4.Abstract_Item_Views.Drop_Only);
return Self;
end;
end Create;
end Constructors;
end Table_View_Big;
table_view_view_test_dd.gpr
with "qt_gui";
project Table_View_Test_DD is
type Build_Modes is ("Application", "Metadata");
Build_Mode : Build_Modes := external ("BUILD_MODE");
for Source_Dirs use (".", ".amoc");
case Build_Mode is
when "Application" =>
for Main use ("main.adb");
for Object_Dir use ".objs";
for Exec_Dir use ".";
when "Metadata" =>
for Languages use ("Amoc");
for Object_Dir use ".amoc";
for Source_Files use ("table_view_small.ads",
"table_view_big.ads");
end case;
package Compiler is
for Default_Switches ("Ada") use ("-g", "-gnat05");
end Compiler;
package IDE is
for QtAda_Amoc_Invocation_Switch use "-XBUILD_MODE=Metadata";
end IDE;
-- for Languages use ("Ada");
package Naming is
for Casing use "lowercase";
end Naming;
end Table_View_Test_DD;

Resources