Ukwakha i-App (Vala + GTK 3) [ingxenye yesithathu]

Kule ngxenye sizobona ukuthi sakha kanjani elinye iwindi bese siliklama nge-GTK. Sizobona nokusebenza okuthile njengokungeza imibuzo nokusebenzisa izinkinobho ezintathu (50%, ukuqandisa nokuphasa).

I-ToolBar ne-ToolButton

Dala i-ToolBar:

app2

Ukwakha i-ToolButton, kulokhu sizobeka isithonjana (ungathola izithonjana eziningi ngokuzenzakalela lapha) nge «from_stock (Gtk.Stock.IconName):

Ukuthathwa kusuka ngo-2013-12-07 23:26:52

Siyabona ukuthi esicelweni sethu sinendawo ephezulu ngensimbi enezinkinobho ezimbili, lapho sizosebenzisa owokuqala ukudala imibuzo emisha bese kuthi owesibili ukungenisa imibuzo (ngefayela):

Ukuthathwa kusuka ngo-2013-11-08 00:30:32

Idala imibuzo:
Inkinobho esiyenze ngaphambili (kubha yamathuluzi) lapho sichofoza kuyo, sizovula iwindi le-gtk elisha elizosivumela ukuthi sengeze imibuzo ku-database yethu:

app1

Ukwakha iwindi elisha sizokwakha isigaba esisha, esizosibiza ngokuthi Imibuzo, nokuthi isigaba sethu sohlelo lokusebenza sizolakha kanjani iwindi elisha (this.window = new Gtk.Window ();)

Sizosebenzisa izinto ezimbalwa ukudala i-graphical interface ngokulandelana;

-Label (Imibuzo)

- Ukungena (lapho sizobhala khona umbuzo)

-Ilebuli (izimpendulo)

- Amabhokisi ama-4 avundlile azoqukatha okufakiwe (impendulo) ne-switch (ukukhetha ukuthi ngabe ilungile yini)

- Inkinobho (ukuqedela)

Siyabona ukuthi kubukeka kanjani:

Ukuthathwa kusuka ngo-2013-12-08 01:07:08

Ukonga umbuzo kuzofanele ukuthi sithole umbhalo wokufakiwe, atholakala nge-get_text () ebuyisa intambo.

app5

Ukwazi ukuthi i-switch iyasebenza yini singasebenzisa indlela yayo get_active () ebuya iyiqiniso uma ivuliwe futhi i-flase uma icishiwe.

 Izinkinobho ezingama-50%, zeFreeze nePhasi:

 -imashumi amahlanu%:

Ku-50% kufanele sibheke kuphela ukuthi iyiphi inkinobho efanele bese sisusa ezi-2 ezingalungile, kulokhu sibakhansela nge-set_sensitive (false).

app4

Umphumela:

app6

-Freeze:

Sibeka ibha ku-0 futhi.

lokhu.timebar.set_fraction (0);

-Pass:

button3.clicked.connect (() => {
this.bd_select_preguntas ();
this.next_pregunta();
});

 Ingxenye elandelayo (4):

Esitolimeni esilandelayo sizobona ukuthi singazithuthukisa kanjani izici zohlelo lwethu, njengokuthi imibuzo ayiveli ngaso sonke isikhathi endaweni efanayo, faka isithonjana kuhlelo lokusebenza ...

 


Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Amazwana ayi-12, shiya okwakho

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

  1.   F3niX kusho

    Ngiyazithanda izimpendulo ... haha ​​.. Sanibonani

  2.   panchomora kusho

    Kuhle kakhulu lezi zihloko ezikhuluma nge-vala .. Ngiyathemba ezinye .. imikhonzo

  3.   hlabo0 kusho

    Ngilinde ukungena kwakho kuVala, ngiyethemba kuningi okulethwayo. Halala!

  4.   pptru kusho

    I-athikili enhle, ngiyabonga ngokwabelana.

  5.   UHiramu kusho

    Sawubona,

    Ngikulandele okufakiwe kwangaphambilini kokwakhiwa kwalolu hlelo lokusebenza, inkinga iza manje lapho ngizama ukufinyelela ukungena kwewindi elisha, ngikwenza ngale ndlela, ngendlela ye-saveC yesigaba se-createQuestions (isigaba esakha iwindi) .

    i-saveC yomphakathi engenalutho () {
    umucu str = umbuzoE.get_text ();
    stdout.printf ("Isivumelwano% s \ n", str);
    }

    Kepha kokukhiphayo ngithola lokhu:
    (bu: 6196): Gtk-CRITICAL **: gtk_entry_get_text: assertion`` GTK_IS_ENTRY (entry) 'yehlulekile

    Isivumelwano (null)

    Ngibone izibonelo ezithile futhi encazelweni yezindlela ezifinyelela kokungenayo benza into enjengale:

    void on_activate (Ukufakwa kwe-Gtk.Entry) {
    igama = entry.get_text ();
    phrinta ("\ nSawubona" ​​+ igama + "! \ n \ n");
    }

    Kepha banokungena okukodwa kuphela futhi kulesi sibonelo kukhona okungu-5, ngakho-ke lapha sengivele ngilahlekile, ungangiqondisa kangcono.

    1.    lolbimbo kusho

      Yebo, lapho udala okufakwayo awubaniki igama elifanayo, ukuthola umbhalo abanakho uyakwenza:

      r1 = ukungena1.get_text ();
      r2 = ukungena2.get_text ();
      r3 = ukungena3.get_text ();
      r4 = ukungena4.get_text ();

      Uma ufuna, faka i-pastebin ngizoyibuka

      1.    UHiramu kusho

        lolbimbo uma empeleni nginawo anamagama ahlukile, kepha ngisebenzisa elilodwa kuphela ekuhlolweni ngoba akekho noyedwa kubo obuyisa umbhalo engiwufakile, ungithumela iphutha elishiwo ngenhla:

        Kepha kokukhiphayo ngithola lokhu:
        (bu: 6196): Gtk-CRITICAL **: gtk_entry_get_text: assertion`` GTK_IS_ENTRY (entry) 'yehlulekile

        Isivumelwano (null)

        Ngisaphenya ...

        Jabulela. !!

      2.    UHiramu kusho

        Nansi imithombo, imikhonzo.
        http://pastebin.com/pZG8GbrY

    2.    lolbimbo kusho

      Sawubona Hiram, bheka, ngizokutshela ukuthi kufanele ukwenze kanjani ukuyixazulula, into yokuqala eyenzekayo ngoba sakha iwindi elisha (akulona eliyinhloko), futhi lapho ubiza ukungena, ( ngiyaxolisa ngamagama) angazi ukuthi kungani leyo shiti ingabuyi sengathi bekungukungena kepha iWijethi, kepha ey, ukuze uyixazulule kufanele ushintshe zonke izinto ezi-static ozidale zaba namandla usebenzisa var:

      var questionE = okusha Gtk.Entry ();

      khona-ke umsebenzi uzosebenza futhi uzothola umbhalo ngaphakathi kokungena.

      i-save.clicked.connect (() => {
      // intambo str = this.questionE.get_text ();
      stdout.printf ("Isivumelwano% s \ n", askE.get_text ());
      });

      Okokugcina, ungakhohlwa ukushintsha umugqa lapho ufaka khona okufakiwe ukukukhombisa:

      buzaE.show ();

      Ngikushiya ikhodi ephelele ngokuguqulwa ukuze ubheke ukuthi isivele iyasebenza, okungukuthi uma kufanele ushintshe zonke izinto (okungenani okufakiwe) ukuze uqhubeke nohlelo.

      http://paste.desdelinux.net/5048

      Phendula ngokucaphuna

      1.    UHiramu kusho

        Chale, ngapha uyahlupha futhi, ngilokhu ngiba nezinkinga, ikhodi ongikhombisa yona ilungile, kuphela okwenzekayo kumcimbi:

        i-save.clicked.connect (() => {
        // intambo str = this.questionE.get_text ();
        stdout.printf ("Isivumelwano% s \ n", askE.get_text ());
        });

        Ingaphakathi kwesigaba seMibuzo futhi isebenza kahle kepha lapho ifuna ukungena kusuka ku-saveC, ayihlanganisi, ingiphonsela leli phutha:

        bu01.vala: 50.38-50.50: iphutha: Ukungqubuzana 1: Ayikwazi ukuguqula isuke kokuthi `Questions.saveC 'iye ku-`Gtk.Button.clicked'
        lokhu.guardar.clicked.connect (this.guardarC);
        ^^^^^^^^^^^^^^
        bu01.vala: 251.58-251.66: isexwayiso: IGtk.Stock yehlisiwe kusukela ngo-3.10
        bu01.vala: 260.59-260.67: isexwayiso: IGtk.Stock yehlisiwe kusukela ngo-3.10
        Ukuhlanganiswa kwehlulekile: amaphutha ama-1, izexwayiso ezi-2

        Ngifuna ukucabanga ukuthi kungenxa yendlela engidlula ngayo ipharamitha lapho kwenzeka umcimbi wokuchofoza:
        lokhu.guardar.clicked.connect (this.guardarC);

        Ngiyabonga kusengaphambili ngempendulo yakho; lapha ngishiya ikhodi ephonsa iphutha: http://pastebin.com/pLzExhrb

      2.    lolbimbo kusho

        Angikayihloli kepha ngicabanga ukuthi ukususa impikiswano emsebenzini kuzokulahla.

        i-saveC yomphakathi engenalutho (Gtk.Entry AskE) {
        umucu str = umbuzoE.get_text ();
        stdout.printf ("Isivumelwano% s \ n", str);
        }

        a:
        i-saveC yomphakathi engenalutho () {
        umucu str = umbuzoE.get_text ();
        stdout.printf ("Isivumelwano% s \ n", str);
        }

      3.    UHiramu kusho

        lolbimbo, ngizamile ukususa impikiswano futhi namanje ayisebenzi,

        Ngisazama ukuqonda le nkinga, ngisha kuVala futhi angitholi mibhalo eminingi, ngiyethemba ukuthola isisombululo kungekudala noma ngilinde wena ukuthi ukhiphe ingxenye yesine ye-xD.

        Ngiyaqhubeka ngizama ...

        Ukubingelela