|
Post by angelo2449 on Dec 29, 2020 3:58:20 GMT -5
This is my code:
Dim Ambiente$(16), Piano$(18)
Ambiente$(0) = "" Ambiente$(1) = "Entrata" Ambiente$(2) = "Disimpegno" Ambiente$(3) = "Cucina" Ambiente$(4) = "Ripostiglio" Ambiente$(5) = "Soggiorno" Ambiente$(6) = "Bagno" Ambiente$(7) = "Servizio" Ambiente$(8) = "Camera" Ambiente$(9) = "Guardaroba" Ambiente$(10) = "Studio" Ambiente$(11) = "Balcone" Ambiente$(12) = "Terrazzo" Ambiente$(13) = "Cantina" Ambiente$(14) = "Box" Ambiente$(15) = "Caldaia"
TipoUni$(0) = "" TipoUni$(1) = "Abitazione" TipoUni$(2) = "Box" TipoUni$(3) = "Cantina" TipoUni$(4) = "Studio" TipoUni$(6) = "Negozio"
Piano$(0) = "" Piano$(1) = "Cantina" Piano$(2) = "Seminterrato" Piano$(3) = "Terreno" Piano$(4) = "Rialzato" Piano$(5) = "Primo" Piano$(6) = "Ammezzato" Piano$(7) = "Secondo" Piano$(8) = "Terzo" Piano$(9) = "Quarto" Piano$(10) = "Quinto" Piano$(11) = "Sesto" Piano$(12) = "Settimo" Piano$(13) = "Ottavo" Piano$(14) = "Nono" Piano$(15) = "Decimo" Piano$(15) = "Ultimo" Piano$(16) = "Mansarsa" Piano$(17) = "Sottotetto"
dim info$(10, 10)
nomainwin WindowWidth = 925 WindowHeight = 520 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "green" ForegroundColor$ = "black"
texteditor #main.edit, -400, -400, 200, 25
xa = 120
statictext #main.t1, "Soggetto corrente >>>", 20, 20, 210, 20 TextboxColor$ = "white" textbox #main.soggcorr, 240, 15, 650, 25 statictext #main.t2, "Edificio Corrente >>>", 20, 55, 210, 20 textbox #main.edicorr, 240, 50, 650, 25
TextboxColor$ = "yellow" statictext #main.tp, "Piano ........... >>>", 20, 170, 210, 20 textbox #main.piano, 240, 165, 200, 25
statictext #main.sc, "Scala >>>", 700, 90, 90, 25 textbox #main.scala, 800, 85, 90, 25 ComboboxColor$ = "yellow" combobox #main.copiano, Piano$(), [Gest.Piani], xxa + 280, 165, 220, 25 combobox #main.coamb, Ambiente$(), [Gest.Ambienti], xxa + 280, yya + 175, 220, 25 combobox #main.cocat, Cat$(), [Gest.Cat], xxa + 280, yya + 129, 220, 25
TextboxColor$ = "white" yya = 85 : xxa = 170 statictext #main.ub, "Indirizzo ....... >>>", 20, 90, 210, 25 textbox #main.ind, 240, 85, 440, 25
statictext #main.t7, "Categoria ....... >>>", 20, yya + 135, 210, 20 button #main.bp, "Apri Categorie", [ApriCategorie], UL, xxa + 510, yya + 129, 210, 25 button #main.un, "Apri Poligoni", [ApriPoligoni], UL, xxa + 510, yya + 175, 210, 25 button #main.un, "Apri Piani", [ApriPiani], UL, xxa + 510, yyya + 165, 210, 25
button #main.un, "Apri Unità", [ApriUnita], UL, xxa + 510, yya + 40, 210, 25
statictext #main.np, "Elenco Ambienti", xxa + 315, yya + 157, 170, 20 groupbox #main.e, " ELENCHI", xxa + 277, 124, 225, 170 statictext #main.tc, "Categorie in Elenco", xxa + 295, 194, 190, 20 statictext #main.tc, "Piani in Elenco", xxa + 315, 144, 190, 20
yyya = 75 statictext #main.t8, "Unità immobiliare >>>", 20, yya + 45, 210, 20 statictext #main.ta, "Ambiente ........ >>>", 20, yya + 180, 210, 20 statictext #main.ar, "Area m² ......... >>>", 20, yya + 235, 210, 20 TextboxColor$ = "yellow" textbox #main.categoria, 240, yya + 129, 200, 25 textbox #main.unita, 240, yya + 40, 200, 25 textbox #main.ambiente, 240, yya + 175, 200, 25 textbox #main.area, 240, yya + 230, 200, 25
statictext #main.t10, "Interno >>>", 20, yya + 280, 120, 20 textbox #main.interno, 140, yya + 275, 80, 25 statictext #main.t11, "Fg >", 225, yya + 280, 40, 20 textbox #main.foglio, 270, yya + 275, 65, 25
statictext #main.tm, "Mapp >", 340, yya + 280, 70, 20 textbox #main.mapp, 405, yya + 275, 70, 25
statictext #main.t12, "Sub >", 480, yya + 280, 50, 20 textbox #main.sub, 535, yya + 275, 70, 25 statictext #main.t13, "Tipo >", 610, yya + 280, 70, 20 combobox #main.tipo, TipoUni$(), [D.Tipo], 680, yya + 275, 210, 25
ya = 120
button #main.bi, "Info", [D.Info], UL, 20, ya + 280, 100, 40 button #main.pu, "Pulisci", [D.Pulisci], UL, 130, ya + 280, 100, 40 button #main.ann, "Annulla", [D.Annulla], UL, 240, ya + 280, 200, 40 button #main.t9, "Apri Ambienti", [ApriAmbienti], UL, xxa + 280, yya + 230, 220, 25 statictext #main.te, "Numero Ambienti", xxa + 540, yya + 210, 220, 20 textbox #main.numamb, xxa + 510, yya + 230, 210, 25 button #main.bp, "Salva Unità", [D.SalvaUnita], UL, xxa + 280, ya + 280, 220, 40 button #main.conf, "Conferma", [D.Conferma], UL, xxa + 510, ya + 280, 210, 40
open "Calcolo Millesimi - Definizione Poligoni by Angelo Ambrogio Montoli - V7 - 2020" for window as #main #main, "font courier_new 10 17 bold" #main, "trapclose [quit.main]"
#main.edit, "!cls"; #main.edit, "!paste"; #main.edit, "!contents? StringaIn$"; StringaIn$ = trim$(StringaIn$) Pos1 = instr(trim$(StringaIn$), "#", 1) Numero$ = left$(StringaIn$, Pos1 - 1) Area$ = mid$(StringaIn$, Pos1 + 1)
#main.soggcorr, Soggetto$ #main.edicorr, Edi$ #main.piano, Piano$ #main.scala, Scala$ #main.ind, Indirizzo$ #main.unita, trim$(UnitaImmobiliare$) #main.area, using("###############.##", val(Area$)) #main.numamb, using("##########", val(NumFile$)) #main.interno, trim$(Interno$) #main.foglio, trim$(Foglio$) #main.mapp, trim$(Mappale$) #main.sub, trim$(Subalterno$) #main.tipo, "select "; Tipo$
#main.copiano, "selectindex 0" #main.coamb, "selectindex 0" #main.cocat, "selectindex 0" #main.coamb, "setfocus"
wait
' ---------------------------
[quit.main] close #main end
Comboboxes do not react immediately! Thank You
|
|
Tasp
Full Member
 
Posts: 198
|
Post by Tasp on Dec 29, 2020 5:17:39 GMT -5
I stripped everything from your code and still got the same issues. I thought it maybe Comboboxes overlapping, font too big for the box etc. But no. And it seems very random. Anytime there is more than one combobox within the window it seems to give only the last one the attribute to colour the window. Doesn't matter if you "Reload" the boxes, still same. It only updates on mouse over events. Even Rod's basic code does the same. nomainwin a$(1) = "one" a$(2) = "two" a$(3) = "three" a$(4) = "four" ComboboxColor$="red" combobox #win.combo, a$(),[doCombo],10,10,120,200
combobox #win.combo2, a$(),[doCombo],10,100,120,200 open "Combobox Demo" for window as #win #win "trapclose [quit]" #win.combo "selectindex 1" wait
[quit] close #win end
If comment out the 2nd box the 1st will always colour, otherwise it appears to be random whether it gets coloured or not. Currently the only solution I can find is to change the Window type to DIALOG, this seems to fix it. nomainwin a$(1) = "one" a$(2) = "two" a$(3) = "three" a$(4) = "four" ComboboxColor$="red" combobox #win.combo, a$(),[doCombo],10,10,120,200 combobox #win.combo2, a$(),[doCombo],10,100,120,200 open "Combobox Demo" for DIALOG as #win #win "trapclose [quit]" #win.combo "selectindex 1" wait
[quit] close #win end
EDIT: Further testing shows that even the DIALOG type window is not immune, 7/10 times it will colour all 4 boxes, then for some reason it will miss the top box. 
|
|
|
Post by Rod on Dec 29, 2020 6:20:42 GMT -5
I think Windows has changed behaviour. This never used to happen. I find the same as Tasp, the color of the comboboxes is applied or painted randomly. Sometimes I get all four colored sometimes none sometimes three. I think it is something to do with screen updates. One for Carl really. Run the code below several times, the comboboxes are sometimes colored sometimes not.
a$(1) = "one" a$(2) = "two" a$(3) = "three" a$(4) = "four"
nomainwin WindowWidth = 925 WindowHeight = 520 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2) ComboboxColor$ = "yellow" BackgroundColor$ = "green" ForegroundColor$ = "black"
combobox #main.copiano, a$(), [Gest.Piani], 100,150,120,200 combobox #main.coamb, a$(), [Gest.Ambienti],200,180,120,200 combobox #main.cocat, a$(), [Gest.Cat], 300,210,120,200 combobox #main.tipo, a$(), [D.Tipo], 400,240,120,200
open "Calcolo Millesimi - Definizione Poligoni by Angelo Ambrogio Montoli - V7 - 2020" for window as #main '#main "font courier_new 10 17 bold" #main "trapclose [quit.main]"
#main.tipo "selectindex 1" #main.copiano "selectindex 1" #main.coamb "selectindex 1" #main.cocat "selectindex 1"
wait
' ---------------------------
[quit.main] close #main end
|
|
|
Post by Rod on Dec 29, 2020 9:09:48 GMT -5
I find that three comboboxes will be colored reliably, but four or more give problems.
nomainwin 'set the foreground, background and combobox colors a$(1) = "one" a$(2) = "two" a$(3) = "three" a$(4) = "four" BackgroundColor$ = "green" ForegroundColor$ = "black" ComboboxColor$="yellow" combobox #w.combo, a$(),[doCombo],10,150,120,200 combobox #w.comb, a$(),[doComb],10,180,120,200 combobox #w.com, a$(),[doCom],10,210,120,200 'combobox #w.co, a$(),[doCo],10,240,120,200 open "test" for window as #w print #w, "trapclose [quit]" #w.combo "selectindex 1" #w.comb "selectindex 2" #w.com "selectindex 3" '#w.co "selectindex 4" wait
[quit] close #w end
|
|
|
Post by mknarr on Dec 29, 2020 11:06:20 GMT -5
It must be something with comboboxes becasue it works with listboxes. Actually you don't need the reload
nomainwin 'set the foreground, background and combobox colors a$(1) = "one" a$(2) = "two" a$(3) = "three" a$(4) = "four" BackgroundColor$ = "green" ForegroundColor$ = "black" ListboxColor$="yellow" listbox #w.combo, a$(),[doCombo],10,150,120,200 listbox #w.comb, a$(),[doComb],10,180,120,200 listbox #w.com, a$(),[doCom],10,210,120,200 listbox #w.co, a$(),[doCo],10,240,120,200 open "test" for window as #w print #w, "trapclose [quit]" '#w.combo "reload" ' #w.comb "reload" ' #w.com "reload" '#w.co "reload" wait
[quit] close #w end
|
|
|
Post by Brandon Parker on Jan 1, 2021 21:42:13 GMT -5
So after some thinking, I have come to the conclusion that the issue, while it might be related to a change within Windows, has something to do specifically with the "Wait" statement. Possibly the "Wait" statement is not correctly acting for all Windows events or something...? This explains why I probably have not seen the issue; I never use the "Wait" statement in my own code. I always have a loop running with "Scan" and a Sleep() function call since I use WMLiberty.dll most of the time.
To resolve the issue, simply place a "Scan" statement immediately prior to the "Wait" statement after opening your window. I tested this running the code below 100 times and each time resulted in both ComboBoxes being painted with a red background as expected. Carl would definitely have to chime is as to why the "Wait" statement might be missing a message to paint one/both of the ComboBoxes randomly when by itself.
There's a Happy New Year present for you!!!
NoMainWin
a$(1) = "one" a$(2) = "two" a$(3) = "three" a$(4) = "four"
ComboboxColor$ = "red"
ComboBox #win.combo, a$(), [doCombo], 10, 10, 120, 200 ComboBox #win.combo2, a$(), [doCombo], 10, 100, 120, 200
Open "Combobox Demo" For Window As #win #win "TrapClose [quit]" Scan Wait
[quit] Close #win End
[doCombo] Wait
{:0)
Brandon Parker
|
|