From: Alain A. <ala...@wa...> - 2016-10-05 14:18:36
|
Hi I have a combobox in a window that I hide using set timer, as I used it elsewhere for ownerbuttons I hide it before creating the window in ON CHANGE, I call a functions which look at a value to know if it must be hidden or shown qout(trim(rScript)) => dir qout(aScripts[rg,4]) => .t. oModDlg, oFolders and oTm2 are public // =============================================================== Function combo_manage(rScript) // =============================================================== local rg for rg=1 to len(aScripts) if trim(rScript)==aScripts[rg,1] qout(trim(rScript)) qout(aScripts[rg,4]) if aScripts[rg,4] SET TIMER oTm2 of oModDlg VALUE 100 ACTION oModDlg:oFolders:show() else SET TIMER oTm2 of oModDlg VALUE 100 ACTION oModDlg:oFolders:hide() endif exit endif next return nil // =============================================================== Where do I fail ? Thanks A+ -- ------------------------------------------------------------------------ Alain Aupeix http://jujuland.pagesperso-orange.fr/ http://pissobi-lacassagne.pagesperso-orange.fr/ ------------------------------------------------------------------------ U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-02 19:20) | Hw.Gui 2.19-6 (2615) ------------------------------------------------------------------------ |
From: Alexander S.K. <al...@be...> - 2016-10-06 11:07:35
|
Alain Aupeix пишет: > Hi > I have a combobox in a window that I hide using set timer, as I used it > elsewhere for ownerbuttons > > I hide it before creating the window Before INIT DIALOG oModDlg statement ? > in ON CHANGE, I call a functions which look at a value to know if it > must be hidden or shown And what happens ? It isn't shown or hidden ? Regards, Alexander. |
From: Alain A. <ala...@wa...> - 2016-10-10 16:26:51
|
Le 06/10/2016 à 13:07, Alexander S.Kresin a écrit : > Alain Aupeix пишет: >> Hi >> I have a combobox in a window that I hide using set timer, as I used it >> elsewhere for ownerbuttons >> >> I hide it before creating the window > Before INIT DIALOG oModDlg statement ? As I said before creating the window (so before INIT DIALOG) >> in ON CHANGE, I call a functions which look at a value to know if it >> must be hidden or shown > And what happens ? It isn't shown or hidden ? It doesn't show the combobox A+ -- ------------------------------------------------------------------------ Alain Aupeix http://jujuland.pagesperso-orange.fr/ http://pissobi-lacassagne.pagesperso-orange.fr/ ------------------------------------------------------------------------ U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-02 19:20) | Hw.Gui 2.19-6 (2615) ------------------------------------------------------------------------ |
From: Alexander S.K. <al...@be...> - 2016-10-11 08:44:22
|
When exactly do you call that function, combo_manage() ? It looks very strange: you add timers in a cycle, so you may have len(aScripts) timers, some of them will show a combobox ( if aScripts[rg,4] ), others - hide. If you call combo_manage() few times, the number of timers increases, these all may work in unpredictable way. Why it is needed to use timers to hide/show the combo ? Regards, Alexander. |
From: Alain A. <ala...@wa...> - 2016-10-11 09:27:35
|
Le 11/10/2016 à 10:44, Alexander S.Kresin a écrit : > When exactly do you call that function, combo_manage() ? When the current item of oScripts changes, in ON CHANGE Some scripts need the use of a parameter which may be choose in oFolders combobox Some not So I want to change the visibility depending of the needings of the current script in oScripts Here is an hard-copy of the window: https://www.dropbox.com/s/9uh292mulgpx4a3/R%C3%A9pertoire%20distant.png?dl=1 and here are is the part of the source the commented lines are the one I want ----------------------------------------------------------------------------------------------- // SET TIMER oTm2 VALUE 100 ACTION {||oFolders:hide()} //ONCE ACTIVATE WINDOW oMainWindow oIcon := HIcon():Addfile( cImageDir+"nohup.png" ) INIT DIALOG oModDlg TITLE "Répertoire distant" ; AT oMainWindow:nLeft+140,oMainWindow:nTop+130 SIZE 340,250 ; FONT oFont ICON oIcon @ 10,10 SAY "Donnez la commande à lancer en nohup" SIZE 320, 22 COLOR hwg_ColorC2N("FF0000") @ 10,34 GET oName VAR dscript SIZE 320, 26 @ 10,72 SAY "Choissez du script à lancer en nohup" SIZE 320, 22 COLOR hwg_ColorC2N("FF0000") @ 10,96 GET COMBOBOX oScript VAR rScript ITEMS aScripts STYLE WS_TABSTOP SIZE 320, 25; TOOLTIP "Choix d'un script distant"; ON CHANGE {||dscript:=rScript,oName:Refresh(),oFolders:show()}; TEXT // ON CHANGE {||dscript:=rScript,oName:Refresh(),combo_manage(rScript)}; @ 10,136 SAY "Donnez le paramètre du script à lancer en nohup" SIZE 320, 22 COLOR hwg_ColorC2N("FF0000") @ 10,160 GET COMBOBOX oFolders VAR rFolders ITEMS aFolders STYLE WS_TABSTOP SIZE 320, 25; TOOLTIP "Choix d'un dossier distant"; ON CHANGE {||dScript:=dscript+" "+trim(rFolders),oName:Refresh()}; TEXT // ON CHANGE {||oName:=oName+" "+trim(rFolders),oName:Refresh()}; @ 60,208 BUTTON "Ok" OF oModDlg ID IDOK ; SIZE 100, 32 COLOR hwg_ColorC2N("FF0000") ; ON CLICK {||oModDlg:lResult:=.t.} @ 180,208 BUTTON "Annuler" OF oModDlg ID IDCANCEL ; SIZE 100, 32 ACTIVATE DIALOG oModDlg ... // ================================================================ Function combo_manage(rScript) // ================================================================ local rg for rg=1 to len(aScripts) if trim(rScript)==aScripts[rg,1] qout(trim(rScript)) qout(aScripts[rg,4]) if aScripts[rg,4] SET TIMER oTm2 VALUE 100 ACTION oModDlg:oFolders:show() else SET TIMER oTm2 VALUE 100 ACTION oModDlg:oFolders:hide() endif exit endif next return nil ----------------------------------------------------------------------------------------------- Thanks A+ -- ------------------------------------------------------------------------ Alain Aupeix http://jujuland.pagesperso-orange.fr/ http://pissobi-lacassagne.pagesperso-orange.fr/ ------------------------------------------------------------------------ U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-04 13:22) | Hw.Gui 2.19-6 (2619) ------------------------------------------------------------------------ |
From: Alexander S.K. <al...@be...> - 2016-10-12 10:19:49
|
Alain Aupeix пишет: > ... > @ 10,96 GET COMBOBOX oScript VAR rScript ITEMS aScripts > ... > // ON CHANGE {||dscript:=rScript,oName:Refresh(),combo_manage(rScript)}; > ... > for rg=1 to len(aScripts) > if trim(rScript)==aScripts[rg,1] If aScripts[rg,1] contains trailing spaces, this condition will never be fulfilled. Here should be: if trim(rScript)==Trim(aScripts[rg,1]) Maybe, this is the reason why the second combobox is never shown. And, anyway, using of timers here isn't correct. You add them again and again after every ON CHANGE. A lot of timers will appear, and each of them try to show or hide your combobox... Why don't you simply hide/show the combo once in ON CHANGE handler, why the timer is needed ? Regards, Alexander. |
From: Alain A. <ala...@wa...> - 2016-10-12 14:27:46
|
Le 12/10/2016 à 12:19, Alexander S.Kresin a écrit : > Alain Aupeix пишет: >> ... >> @ 10,96 GET COMBOBOX oScript VAR rScript ITEMS aScripts >> ... >> // ON CHANGE {||dscript:=rScript,oName:Refresh(),combo_manage(rScript)}; >> ... >> for rg=1 to len(aScripts) >> if trim(rScript)==aScripts[rg,1] It was a typo, the test works, as trim(rScript)==rScript (no need of trim) > And, anyway, using of timers here isn't correct. You add them again > and again after every ON CHANGE. A lot of timers will appear, and each > of them try to show or hide your combobox... > Why don't you simply hide/show the combo once in ON CHANGE handler, > why the timer is needed ? Yes, no need of timer, I just used the trick you give me about two buttons I need to hide in a window and show in a case, but after the window was displayed. But I found a better way to do it Just add a line like this after the object to hide: @ 10,230 SAY "" SIZE 1,1 ON INIT {||oFolders:hide()} It displays nothing (what I want) but immediatly hide the combo Really better than a timer Thanks A+ -- ------------------------------------------------------------------------ Alain Aupeix http://jujuland.pagesperso-orange.fr/ http://pissobi-lacassagne.pagesperso-orange.fr/ ------------------------------------------------------------------------ U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-04 13:22) | Hw.Gui 2.19-6 (2619) ------------------------------------------------------------------------ |
From: Alexander S.K. <al...@be...> - 2016-10-13 10:22:45
|
Alain Aupeix пишет: > > But I found a better way to do it > > Just add a line like this after the object to hide: > > @ 10,230 SAY "" SIZE 1,1 ON INIT {||oFolders:hide()} > The better is: @ 10,160 GET COMBOBOX oFolders ... ON INIT {|o|o:Hide()} > It displays nothing (what I want) The following, modified a bit for better understanding, works normally: #include "hwgui.ch" Static oModDlg, aScripts := { "one","two","three","four" } Function Main Local oName, oScript, rscript := 1, dscript Local oFolders, aFolders := { "aa","bb" }, rfolders := 1 INIT DIALOG oModDlg TITLE "Repertoire distant" ; AT 0,0 SIZE 340,250 @ 10,10 SAY "Donnez la commande a lancer en nohup" SIZE 320, 22 COLOR hwg_ColorC2N("FF0000") @ 10,34 GET oName VAR dscript SIZE 320, 26 @ 10,72 SAY "Choissez du script a lancer en nohup" SIZE 320, 22 COLOR hwg_ColorC2N("FF0000") @ 10,96 GET COMBOBOX oScript VAR rScript ITEMS aScripts ; STYLE WS_TABSTOP SIZE 320, 25 TOOLTIP "Choix d'un script distant"; ON CHANGE {||dscript:=rScript,oName:Refresh(),combo_manage(rScript)} TEXT @ 10,136 SAY "Donnez le parametre du script a lancer en nohup" SIZE 320, 22 COLOR hwg_ColorC2N("FF0000") @ 10,160 GET COMBOBOX oFolders VAR rFolders ITEMS aFolders ; STYLE WS_TABSTOP SIZE 320, 25 TOOLTIP "Choix d'un dossier distant" ; ON CHANGE {||dScript:=dscript+" "+trim(rFolders),oName:Refresh()} ; ON INIT {|o|o:Hide()} TEXT @ 60,208 BUTTON "Ok" OF oModDlg ID IDOK SIZE 100, 32 COLOR hwg_ColorC2N("FF0000") ; ON CLICK {||oModDlg:lResult:=.t.} @ 180,208 BUTTON "Annuler" OF oModDlg ID IDCANCEL SIZE 100, 32 ACTIVATE DIALOG oModDlg Return Nil Function combo_manage(rScript) if rscript == "two".or. rscript == "four" oModDlg:oFolders:show() else oModDlg:oFolders:hide() endif return nil Regards, Alexander. |
From: Alain A. <ala...@wa...> - 2016-10-13 13:36:28
|
Le 13/10/2016 à 12:22, Alexander S.Kresin a écrit : > Alain Aupeix пишет: >> But I found a better way to do it >> >> Just add a line like this after the object to hide: >> >> @ 10,230 SAY "" SIZE 1,1 ON INIT {||oFolders:hide()} >> > The better is: > > @ 10,160 GET COMBOBOX oFolders ... ON INIT {|o|o:Hide()} I have tried your version, and it fails to build: alain@Gramps-JujuLand:/opt/Maintsys/source$ hwbuild test Harbour 3.2.0dev (r1610041322) Copyright (c) 1999-2016, http://harbour-project.org/ Compiling 'test.prg'... test.prg(24) Error E0030 Syntax error "syntax error at '@'" test.prg(33) Warning W0003 Variable 'OFOLDERS' declared but not used in function 'MAIN(7)' test.prg(33) Warning W0003 Variable 'RFOLDERS' declared but not used in function 'MAIN(7)' 1 error No code generated. If I comment the line 24 and remove ; on line 23, it builds, and obviously doesn't hide on init. A+ -- ------------------------------------------------------------------------ Alain Aupeix http://jujuland.pagesperso-orange.fr/ http://pissobi-lacassagne.pagesperso-orange.fr/ ------------------------------------------------------------------------ U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-04 13:22) | Hw.Gui 2.19-6 (2619) ------------------------------------------------------------------------ |
From: Alexander S.K. <al...@be...> - 2016-10-14 07:09:53
|
Alain Aupeix пишет: >> @ 10,160 GET COMBOBOX oFolders ... ON INIT {|o|o:Hide()} > I have tried your version, and it fails to build: > > alain@Gramps-JujuLand:/opt/Maintsys/source$ hwbuild test > Harbour 3.2.0dev (r1610041322) > Copyright (c) 1999-2016, http://harbour-project.org/ > Compiling 'test.prg'... > test.prg(24) Error E0030 Syntax error "syntax error at '@'" It seems that you doesn't apply the changes, which was few days ago: 2016-10-10 12:20 UTC+0300 Alexander Kresin <al...@be...> * include/guilib.ch * ON INIT and ON SIZE clauses added to few others @ ... GET ... commands. Regards, Alexander. |
From: Alain A. <ala...@wa...> - 2016-10-14 07:36:13
|
Le 14/10/2016 à 09:09, Alexander S.Kresin a écrit : > Alain Aupeix пишет: > >>> @ 10,160 GET COMBOBOX oFolders ... ON INIT {|o|o:Hide()} >> I have tried your version, and it fails to build: >> >> alain@Gramps-JujuLand:/opt/Maintsys/source$ hwbuild test >> Harbour 3.2.0dev (r1610041322) >> Copyright (c) 1999-2016, http://harbour-project.org/ >> Compiling 'test.prg'... >> test.prg(24) Error E0030 Syntax error "syntax error at '@'" > It seems that you doesn't apply the changes, which was few days ago: > > 2016-10-10 12:20 UTC+0300 Alexander Kresin <al...@be...> > * include/guilib.ch > * ON INIT and ON SIZE clauses added to few others @ ... GET ... > commands. Sorry, I didn't take attention to r2622 Thanks A+ -- ------------------------------------------------------------------------ Alain Aupeix http://jujuland.pagesperso-orange.fr/ http://pissobi-lacassagne.pagesperso-orange.fr/ ------------------------------------------------------------------------ U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-04 13:22) | Hw.Gui 2.19-6 (2619) ------------------------------------------------------------------------ |
From: Alain A. <ala...@wa...> - 2016-10-14 08:14:00
|
Le 14/10/2016 à 09:36, Alain Aupeix a écrit : > Le 14/10/2016 à 09:09, Alexander S.Kresin a écrit : >> Alain Aupeix пишет: >> >>>> @ 10,160 GET COMBOBOX oFolders ... ON INIT {|o|o:Hide()} Another solution I tried elsewhere: ACTIVATE DIALOG oNohup ON ACTIVATE {||oFolders:Hide()} A+ -- ------------------------------------------------------------------------ Alain Aupeix http://jujuland.pagesperso-orange.fr/ http://pissobi-lacassagne.pagesperso-orange.fr/ ------------------------------------------------------------------------ U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-04 13:22) | Hw.Gui 2.19-6 (2624) ------------------------------------------------------------------------ |