vscrollbar not activated message

Moderator: Rathinagiri

bluebird
Posts: 66
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 9 times
Been thanked: 2 times

vscrollbar not activated message

Post by bluebird » Mon Mar 20, 2017 6:49 pm

Mentors

The program below is a convenience routine that I use to test ideas and to learn how things work. The matrix demonstration triggered by the DO SOMETHING button works, but the background and foreground matrix colors will only appear after I touch a scrollbar.

1. Why is this the case, I expected to see the Background and font colors right away
2. The msgbox appears to confirm that the scrollbar is active, but the lines 111 and 122 had to be commented out because error messages appear to say that the vscrollbar is not defined.
3. How do I tell the virtual window to scroll to a desired row?

Here is the entire code. I left line 122 uncommented so that you see the error message. If you put the "//" back
you can see the program work, showing the color delay problem.

Code: Select all

/*
* HMG General Test Routine
* 
*/
// Usefull string  "("+alltrim(str(j))+","+ alltrim(str(k))+")" //cBlankInput

#include "hmg.ch"
#include "defines.ch"
#include "MatrixHdr.ch"
#define NEWLINE 13
#define DODGERBLUE {28,134,248}
#define LIGHTGOLDENROD {238 ,221 ,130 }
#define MAROON {238 ,48 ,100 }
#define COBALT1 {0,71,171}
#define COBALT2 {61,82,200}

* Set of define constants for gentest matrix draw demo
*
* nRow1,nCol1,nRowSpc,nColSpc,nWidth,nHeight,nFontSz,aBackColor ,aFontColor,cWindow
*
#define ROW1 1
#define COL1 2
#define ROWSPC 3
#define COLSPC 4
#define CELLWIDTH 5
#define CELLHEIGHT 6
#define FONTSZ 7
#define BACKCOLOR1 8
#define FONTCOLOR1 9
#define TITLEROW 10
#define TITLEHEIGHT 11
#define CODEBLOCK1  12
#define WINFORM 13
#define LABELVALUE 14
#define LABELNAME 15
#define LOOPFUNCTNS 16
#define MTITLE 17
#define HDRFONTNAME 18
#define LABELFONTNAME 19
*-----------------------------
Function Main
*-----------------------------

Local l2Tests:=.t.
LOCAL aTestArray:=array(4)


  
   
SET AUTOSCROLL ON
	DEFINE WINDOW Win_1 ;
		ROW 10 ;
		COL 10 ;
		WIDTH 750 ;
		HEIGHT 650 ;
        VIRTUAL WIDTH 1000 ;
        VIRTUAL HEIGHT 750 ; 
		BACKCOLOR {12,130,55} ;
		TITLE 'A General Test Form!' ;
		WINDOWTYPE MAIN   

	END WINDOW
	ON KEY Escape of Win_1 ACTION {||(Win_1.release)}


	Define BUTTON TestIt
	Parent win_1
	Row 650
	Col 25
	CAPTION "Click to Test Something"  
    WIDTH 220  
    Height 40 	
    ONCLICK {||MsgInfo( Str ( Win_1.VScrollBar.Value ) ), DoSomething()}
	END BUTTON
	
	Define BUTTON TestAnother
	Parent win_1
	Row 650
	Col 290
	CAPTION "Click to Test Another"  
    WIDTH 220
    Visible l2Tests 	
    Height 40 	
    ONCLICK DoSomethingElse()
	END BUTTON
	Win_1.Center
	
	ACTIVATE WINDOW Win_1
	
ON KEY ESCAPE of win_1 action {||(win_1.release)}
Return


*-----------------------------------------------------------------------------------
Function DoSomething()
* nRow1,nCol1,nRowSpc,nColSpc,nWidth,nHeight,nFontSz,aBackColor,aFontkColor,bOnCLick,
* cForm,bLabelValue,labelName,loopfunctions,MatrixTitle,hdr font,Label Font
*------------------------------------------------------------------------------------
Local nRows,nCols,cForm,cVaue
Local aMParameters:={}

* Define and set up parameters for Drawmatrix()
*
Local cTitle:=" Demonstration of an Array of Labels "
Local bLoopLogic:={|l,m|LoopFunctions(l,m)}
Local bOnClickCode:={||(This.Value:=This.name)}


Local bFirstVal:={|k,l|alltrim(str(k*l))}
PRIVATE cBlankInput:="-*-"
//SetProperty( "Win_1", "VScrollBar" , "value" , 0  )

*=====================================================================
*Set Up parameters to call DrawMatrix()
*=====================================================================

aMParameters:={10,10,2,2,45,40,9,DODGERBLUE,YELLOW,4,40,bOnClickCode,"Win_1",;
              bFirstVal,"TLbl",bLoopLogic,cTitle,"Times New Roman","Arial"}  //NIL}
cForm:="Win_1";nRows:=8;nCols:=10

DrawMatrix(nRows,nCols,aMParameters)
Win_1.VScrollBar.Value :=750
Return

*---------------------------------------------------------------------*
Function DrawMatrix(nRows,nCols,aMParameters )
*
* Draws a matrix of Cells - nRows X nCols 
*
*Parameters list must be set up prior to call. Element names are
*Defined in MatrixHdr.ch. 
*Elements WINFORM and LABELNAME are sting literals and require &'s
*Element CODEBLOCK1  is a code block for the ON CLICK procedure
*Element LABELVALUE  is a code block for the initial VALUE of the cells
*Element LOOPFUNCTNS is a code block to execute code specific to the loop
*Element MTITLE creates a Title Label unless it is set to NIL 
*---------------------------------------------------------------------*
Local j,k,clabel,cForm, cTitle


cForm:=aMParameters[WINFORM]
cTitle:=aMParameters[MTITLE]
nTitleRow:=aMParameters[TITLEROW]
nTitleHeight:=iif(cTitle!=NIL,aMParameters[TITLEHEIGHT],0)

if cTitle != NIL
Define Label cTitle
	  PARENT &cForm
      Row aMParameters[TITLEROW]
      Col aMParameters[COL1]
      WIDTH (aMParameters[COLSPC]+aMParameters[CELLWIDTH])*nCols
      HEIGHT aMParameters[TITLEHEIGHT]
      FONTNAME aMParameters[HDRFONTNAME] //"Ariel"
	  ONCLICK {||This.backcolor:=DODGERBLUE}
      BACKCOLOR  aMParameters[BACKCOLOR1] //aBackColor
      FONTCOLOR  aMParameters[FONTCOLOR1]
	  VALUE cTitle
      FONTSIZE aMParameters[FONTSZ]*2
End Label
EndIf	  
	  
for j:=1 to nRows
   for k := 1 TO nCols
      clabel :=aMParameters[LABELNAME]+ alltrim( str(j)) + alltrim(str(k) )
	  
      // are there additional actions to take in the loop?	  
      if aMParameters[LOOPFUNCTNS]!=Nil
	     eval(aMParameters[LOOPFUNCTNS],j,k)
	  endif
	  
      DEFINE label &clabel
	  PARENT &cForm
	  VALUE eval(aMParameters[LABELVALUE],j,k) //c1stVal          
      Row max(nTitleHeight+aMParameters[TITLEROW],aMParameters[ROW1]);
	      +2*aMParameters[ROWSPC]+(aMParameters[CELLHEIGHT]+aMParameters[ROWSPC])*(j-1)
      Col aMParameters[COL1]+(aMParameters[CELLWIDTH]+aMParameters[COLSPC])*(k-1)
	  ON CLICK {||(eval (aMParameters[CODEBLOCK1]))} 
      WIDTH aMParameters[CELLWIDTH]
      HEIGHT aMParameters[CELLHEIGHT]
      FONTNAME aMParameters[HDRFONTNAME] //"Ariel"
      BACKCOLOR aMParameters[BACKCOLOR1]
      FONTCOLOR aMParameters[FONTCOLOR1]
      FONTSIZE aMParameters[FONTSZ]
      END LABEL
 
   next k
next j


Return Nil
Function LoopFunctions(i,j)
   if i=9 .AND. j=9
     msgbox("Testling Loop function for ij=" +"(" +alltrim(str(i)) +"," +alltrim(str(j))+")" )
   endif

return 

*--------------------------------
Function DoSomethingElse()
*--------------------------------
msgbox("Nothing to do here")
return
Last edited by bluebird on Thu Mar 23, 2017 4:39 am, edited 2 times in total.

User avatar
Pablo César
Posts: 4038
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 99 times
Been thanked: 170 times

Post by Pablo César » Mon Mar 20, 2017 6:59 pm

Hey man, please put your codes embraced with CODE tags... please...

It's terrible to read like this... without ident sources... scrolling screen...

I can not imagining to see this in cellphone... OMG
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

bluebird
Posts: 66
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 9 times
Been thanked: 2 times

Post by bluebird » Mon Mar 20, 2017 8:19 pm

Sorry for being so HMG Forum illiterate. I would like to find out about these "code tags".

The code I sent you was copied from Notepad +

User avatar
Pablo César
Posts: 4038
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 99 times
Been thanked: 170 times

Post by Pablo César » Mon Mar 20, 2017 8:43 pm

Yes you can copy from any editor. But you need to start a tag and end the "code" tag.

You can edit by your self your first message putting code tags.
Screen135.png
Screen135.png (43.5 KiB) Viewed 315 times
Here is a brief explanation.

app.php/help/bbcode#f2r1
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Pablo César
Posts: 4038
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 99 times
Been thanked: 170 times

Post by Pablo César » Mon Mar 20, 2017 10:00 pm

Hard to understand and no way to compile without your missing include files.

I got compiling without error cutting off VScrollBar new assigning.
Screen138.png
Screen138.png (27.82 KiB) Viewed 304 times
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

bluebird
Posts: 66
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 9 times
Been thanked: 2 times

Post by bluebird » Tue Mar 21, 2017 2:19 pm

Dear Mentors

I added the code tags to the original submission.

The include files were pasted in before I sent this version, ie. all #defines should be included at the top of file

Thanks

User avatar
Pablo César
Posts: 4038
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 99 times
Been thanked: 170 times

Post by Pablo César » Tue Mar 21, 2017 5:42 pm

Please re-edit your first message again.
  1. Check in your editing msg the line after as it is here by the selected in blue backcolor (see pic below)
    Screen139.png
    Screen139.png (43.78 KiB) Viewed 236 times
     
  2. You will see something like this:
    Screen140.png
    Screen140.png (10.61 KiB) Viewed 233 times
     
  3. By selecting block and cut it by the edit-command Ctrl X the part be selected and cutted is  [/code] (see in red color)
     
  4. Make position with cursor at final of your code and paste on it with the edit-command Ctrl V
     
  5. Remove where is "code" and slash "code" at end of your message that you have duplicated:
    Screen141.png
    Screen141.png (12.71 KiB) Viewed 232 times
     
  6. Submit your message. That's all...
Following by the exactly I've described, you will get your source-code braced in CODE TAGs.
 
Brief tutorial: viewtopic.php?f=13&t=5182
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

bluebird
Posts: 66
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 9 times
Been thanked: 2 times

Post by bluebird » Thu Mar 23, 2017 4:43 am

time cane you or another mentor explain what is wrong with the color rendering of the matrix labels situated in the virtual size window, and how to force the vertical scrollbar to a desired position.

User avatar
Pablo César
Posts: 4038
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 99 times
Been thanked: 170 times

Post by Pablo César » Thu Mar 23, 2017 10:52 am

My mother taught me to say "thank you" when someone does a kindness.

Being cordial and generous, does not take out your merits, on the contrary.

Bill, this is not the first time you make me a snubbing ... :|
 
Screen147.png
Screen147.png (58.05 KiB) Viewed 164 times
By the way... congratulations for having managed to put your code between CODE TAGS.

Another mentor (as yourself said) could explains to you for the rest of your problems... :mrgreen:
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

bluebird
Posts: 66
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 9 times
Been thanked: 2 times

Post by bluebird » Sun Mar 26, 2017 2:20 am

DEAR Mentors

Now that the original post has the code tags assigned, Can some kind and knowledgeable soul run it and explain why the virtual size window vertical scrollbar does not work

THANKS ALL

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests