PHP의 코드에서 솔루션을 찾았지만 명령을 ada로 전송했지만 질문을 남기고 대답하는 것이 유용하다고 생각합니다.
단추를 만들면 레이블 개체도 만들어지고 단추에 추가됩니다. 그것은 얻을 수있는 레이블 개체 - Get_Child-- 기능을 누른 다음 정상적인 레이블로 레이블 개체를 사용합니다. 다음과 같이
명령은 다음과 같습니다
Set_Markup(GTk_Label(Get_Child (Button_S)), "<span weight=""bold"" color=""blue"" size=""xx-large"">It Works!!</span>");
전체 코드는 다음과 같습니다
with GLib; use GLib;
with Gtk.Window; use Gtk.Window;
with Gtk.Frame; use Gtk.Frame;
with Gtk.Button; use Gtk.Button;
with Gtk.Widget; use Gtk.Widget;
with Gtk.Label; use Gtk.Label;
with Pango.Font; use Pango.Font;
with Gtk.Handlers;
with Gtk.Main;
procedure button_label_test is
Window : Gtk_Window;
Frame : Gtk_Frame;
Button_S : Gtk_Button;
package Handlers is new Gtk.Handlers.Callback (Gtk_Widget_Record);
package Return_Handlers is
new Gtk.Handlers.Return_Callback (Gtk_Widget_Record, Boolean);
function Delete_Event (Widget : access Gtk_Widget_Record'Class)
return Boolean is
begin
return False;
end Delete_Event;
procedure Destroy (Widget : access Gtk_Widget_Record'Class) is
begin
Gtk.Main.Main_Quit;
end Destroy;
-- This is the function to modify the characteristics of the label of the button
procedure Clicked (Widget : access Gtk_Widget_Record'Class) is
begin
Set_Markup(GTk_Label(Get_Child (Button_S)), "<span weight=""bold"" color=""blue"" size=""xx-large"">It Works!!</span>");
end Clicked;
begin
Gtk.Main.Init;
Gtk.Window.Gtk_New (Window);
Set_Default_Size (Window, 200, 200);
Gtk.Window.Set_Title (Window, "Button Label test");
Gtk_New (Frame);
Gtk_New (Button_S, "Try");
Add (Frame, Button_S);
Add (Window, Frame);
Return_Handlers.Connect
( Window,
"delete_event",
Return_Handlers.To_Marshaller (Delete_Event'Access)
);
Handlers.Connect
( Window,
"destroy",
Handlers.To_Marshaller (Destroy'Access)
);
Handlers.Connect
( Button_S,
"clicked",
Handlers.To_Marshaller (Clicked'Access)
);
Show_All (Window);
Show (Window);
Gtk.Main.Main;
end button_label_test;
내가 그것을 누군가에 유용 할 것이라 생각합니다.