Re: GtkEntry
- From: Liomar da Hora <liomarhora gmail com>
- To: Ian Martin <martin_id vodafone co nz>, gtkmm-list gnome org
- Subject: Re: GtkEntry
- Date: Sun, 31 Jan 2016 19:24:27 -0300
hi,
I tried resized within the Grid and did not happen. I tried to resize within this frame and within the grid and not worked. Finally I put the frame inside the box and the box on the grid and it worked.
I will put the code below:
Agenda.h
#ifndef AGENDA_H
#define AGENDA_H
#include<gtkmm-3.0/gtkmm/window.h>
#include<gtkmm-3.0/gtkmm/radiobutton.h>
#include<gtkmm-3.0/gtkmm/grid.h>
#include<gtkmm-3.0/gtkmm/enums.h>
#include<gtkmm-3.0/gtkmm/entry.h>
#include<gtkmm-3.0/gtkmm/label.h>
#include<gtkmm-3.0/gtkmm/frame.h>
#include<gtkmm-3.0/gtkmm/box.h>
#include<gtkmm-3.0/gtkmm/buttonbox.h>
#include<gtkmm-3.0/gtkmm/separator.h>
#include<gtkmm-3.0/gtkmm/button.h>
#include<gtkmm-3.0/gtkmm/calendar.h>
#include<gtkmm-3.0/gtkmm/application.h>
#include<glibmm-2.4/glibmm/refptr.h>
#include<glibmm-2.4/glibmm/ustring.h>
class Agenda : public Gtk::Window
{
public:
Agenda();
virtual ~Agenda();
protected:
Gtk::Entry ent_nome, ent_endereco, ent_bairro, ent_horario, ent_telefone, ent_celular, ent_servico, ent_taxa;
Gtk::Label lab_nome, lab_endereco, lab_bairro, lab_horario, lab_telefone, lab_celular, lab_servico, lab_taxa;
Gtk::ButtonBox boxbotao;
Gtk::Button bt_novo, bt_editar, bt_cancelar, bt_excluir, bt_fechar;
Gtk::Frame fr_clienteB, *fr_Entry, fr_clienteG, fr_Sexo;
Gtk::Box hbox, vbox, *hbox_entry;
Gtk::Separator separador;
Gtk::Grid grade;
Gtk::RadioButton rb_sexoF, rb_sexoM;
};
Agenda.cpp
#include "agenda.h"
#include<iostream>
Agenda::Agenda(): lab_nome("Nome"), lab_endereco("Endereço"), lab_bairro("Bairro"),
lab_telefone("Telefone"), lab_celular("Celular"), lab_servico("Tipo de Serviço"), lab_horario("Horário Marcado"),
lab_taxa("Taxa de Serviço"), hbox(Gtk::ORIENTATION_HORIZONTAL, 5), vbox(Gtk::ORIENTATION_VERTICAL)
{
set_title("Agendamento de Asteca");
set_default_size(600,400);
fr_clienteB.set_label("Clientes");
fr_clienteB.set_shadow_type(Gtk::SHADOW_ETCHED_OUT);
fr_clienteB.add(grade);
//Nome
grade.attach(lab_nome, 0, 0, 1, 1);
lab_nome.set_halign(Gtk::ALIGN_START);
lab_nome.set_margin_top(10);
// grade.attach(ent_nome, 0, 1, 1, 1);
// ent_nome.set_width_chars(30);
fr_Entry = new Gtk::Frame();
fr_Entry->set_shadow_type(Gtk::SHADOW_NONE);
hbox_entry = new Gtk::Box();
hbox_entry->add(*fr_Entry);
fr_Entry->add(ent_nome);
hbox_entry->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
ent_nome.set_width_chars(30);
ent_nome.set_max_length(30);
ent_nome.set_max_width_chars(30);
grade.attach(*hbox_entry, 0,1,1,1);
//sexo
fr_Sexo.set_label("Sexo");
fr_Sexo.set_margin_top(10);
fr_Sexo.set_margin_left(30);
fr_Sexo.add(hbox);
hbox.pack_start(rb_sexoF);
hbox.pack_start(rb_sexoM);
rb_sexoF.set_label("Feminino");
rb_sexoM.set_label("masculino");
grade.attach(fr_Sexo, 2, 0, 1, 2);
//Endereço
grade.attach(lab_endereco, 0,2,1,1);
lab_endereco.set_halign(Gtk::ALIGN_START);
lab_endereco.set_margin_top(10);
fr_Entry = new Gtk::Frame();
fr_Entry->set_shadow_type(Gtk::SHADOW_NONE);
hbox_entry = new Gtk::Box();
hbox_entry->add(*fr_Entry);
fr_Entry->add(ent_endereco);
hbox_entry->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
ent_endereco.set_width_chars(25);
ent_endereco.set_max_length(25);
ent_endereco.set_max_width_chars(25);
grade.attach(*hbox_entry, 0,3,1,1);
vbox.pack_start(fr_clienteB);
vbox.pack_start(separador);
/* fr_clienteG.set_label("Grade");
fr_clienteG.add(grade);
ent_endereco.set_margin_left(5);
// grade.add(lab_endereco);
// grade.add(ent_endereco);*/
vbox.add(fr_clienteG);
add(vbox);
show_all_children();
}
Agenda::~Agenda()
{
}
main.cpp
#include "agenda.h"
int main(int argc, char *argv[])
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "liomarhora");
Agenda ag;
return app->run(ag);
}
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]