Re: Adding a GUI

new topic     » goto parent     » topic index » view thread      » older message » newer message

Next, Kat's program has a hard-coded server name (one of several available, which you could change by editing code). We'll make those into a drop-down list for easy selection:

sequence serverlist = { -- expand as needed; 
  "irc.freenode.net:6667", 
  "hobana.freenode.net:6667", -- does PING-PONG 
  $} 

And attach them to a drop-down Combo control:

object srv = gtk:create(GtkComboBoxText,"tooltip text=Selected Server") 
add(srv,serverlist) -- populate the drop-down list of servers; 
set(srv,"active",1) -- make first server the default shown on startup; 

Kat's code also generates a pseudo-random nick which changes on each run:

sequence my_nick = "katircbotv4-"& sprintf("%d",rand(99)) 

We'll keep this, but show it so that it could be changed if desired:

object nik = gtk:create(GtkEntry,"tooltip text=My Nick,placeholder text=" & my_nick) 

Later, when our connect function runs, we obtain the current nik from that control:

  if length(gtk:get(nik,"text")) > 0 then my_nick = gtk:get(nik,"text") -- use the entered value, if any; 
  else my_nick = gtk:get(nik,"placeholder text") -- if not, use the pre-generated default; 
  end if 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu