Hid | show and save in GFX

how to replace this function

x = Param("x_origin", 20, 0, 1980, 20);
y = Param("y_origin", 20, 0, 1024, 20);
demo = ParamToggle("Show Demo", "No|Yes", 1);

if (demo) {
	
	GuiDemos(x+80, y+80);
	
}

by hid | show (GfxCheckBox)

and all computed value in the boxes will disappear when i exit amibroker or when i hid it using the ParamToggle

how to keep my computed value


_SECTION_BEGIN("Moon Calendar Trading System (MCTS)");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
procedure SetOrigin(x0, y0) {
	global _x0, _y0;
	_x0 = x0; _y0 = y0;
}

procedure GfxSetColors(fgColor, bgColor) {
	GfxSetTextColor(fgColor); GfxSetBkColor(bgColor); 
	GfxSelectPen(fgColor); GfxSelectSolidBrush(bgColor);
}
procedure GfxFrame(titl,hheight, x, y, width, height, textColor, bgColor) {
	global _x0, _y0;
	x = x+_x0; y = y+_y0;
	GfxSetColors(textColor, bgColor);
    GfxRoundRect(x, y+0.5*hheight, x+width, y+height, 5, 5);
    if (titl != "") {
		w = GfxGetTextWidth(titl)*0.68; m = x+width*0.5;
		// GfxRectangle(m-w, y+1, m+w, y+hheight-1); 
		GfxRoundRect(m-w, y+1, m+w, y+hheight-1, 5, 5); 
		GfxDrawText(titl, x, y, x+width, y+hheight, 1|4|32);
		
    }
}

// Gui* part - Edit control
function SetNumber(idEdit, Value, x, y, width, height, textColor, bgColor) {
    global _x0, _y0;
	local rc;
	
    x = x+_x0; y = y+_y0;
    rc = GuiEdit( idEdit, x, y, width, height, 0); 
    GuiSetValue(idEdit, Value ); 
    GuiSetColors( idEdit, idEdit, 1, textColor, bgColor, textColor);
   
    return Value;
}
/*
Then modify all lines (replace EditNumber by SetNumber) starting from n3:
	n3 = SetNumber(3, (n2+n)/2, 180, 150, 80, 25, colorBlue, colorYellow);
// etc
*/
function EditNumber(idEdit, initialValue, x, y, width, height, textColor, bgColor) {
    global _x0, _y0;
	local rc;
	
    x = x+_x0; y = y+_y0;
    rc = GuiEdit( idEdit, x, y, width, height, 0); 
    if( rc == guiNew ) GuiSetValue(idEdit, initialValue ); 
    GuiSetColors( idEdit, idEdit, 1, textColor, bgColor, textColor);
   
    
    return GuiGetValue(idEdit);
}


 DT_VCENTER = 4 | 32; 
// format: 0 left, 1 center, 2 right
procedure GfxLabel(text, x, y, width, height, format) {
	global _x0, _y0;
	x = x+_x0; y = y+_y0;
	GfxDrawText( text, x, y, x+width, y+height, format | DT_VCENTER ); 
}

procedure GuiDemos(x,y) {
	local n,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,
	      n12,n13,n14,n15,n16,n17,n18,n19,n20
	      ,n21,n22,txt;
	      
	// GfxSelectFont("Arial", 9); GuiSetFont("Arial", 10);
	SetOrigin(x,y);
	GfxFrame("Moon Night Calendar Trading System", 30, 0, 30, 600, 600, colorWhite, colorblack); // 30, 0, 30, 700, 180, colorWhite, colorblack(30, 0, 30, WITDTH, HIGHT, colorWhite, colorblack )
	SetOrigin(x+20,y+30);
		///////////// TEXTBOX //////////////
	n = EditNumber(1, 0, 45, 65, 80, 25, colorBlue, colorYellow);
	n2 = EditNumber(2, 0, 400, 65, 80, 25, colorBlue, colorYellow); //2, 0, 200, 65, 80, 25, colorBlue, colorYellow ## SECOUND TEXTBOX, formula , LIFT / RIGHT, HIGHT/LOW, WIDTH OF THE TEXT BOX , HIGHT OF THE TEXT BOX
	
	n3 = SetNumber(3, (n2+n)/2, 180, 150, 80, 25, colorBlue, colorYellow);//textbox # , formula , LIFT / RIGHT , HIGHT/LOW , WIDTH OF THE TEXT BOX , HIGHT OF THE TEXT BOX.
	n4 = SetNumber(4, (n2+n)/2, 280, 150, 80, 25, colorBlue, colorYellow);
	n5 = SetNumber(5, (n2+n)/2, 380, 150, 80, 25, colorBlue, colorYellow);
	n6 = SetNumber(6, (n2+n)/2, 480, 150, 80, 25, colorBlue, colorYellow);
	
	n7 = SetNumber(7,(n2+n)/3 , 180, 240, 80, 25, colorBlue, colorYellow);
	n8 = SetNumber(8, (n2+n)/3, 280, 240, 80, 25, colorBlue, colorYellow);
	n9 = SetNumber(9, (n2+n)/3, 380, 240, 80, 25, colorBlue, colorYellow);
    n10 = SetNumber(10, (n2+n)/3, 480, 240, 80, 25, colorBlue, colorYellow);
	                                                                           // add formula for missing 3 days here
	n11 = SetNumber(11, (n2+n)/4, 180, 330, 80, 25, colorBlue, colorYellow);
	n12 = SetNumber(12, (n2+n)/4, 280, 330, 80, 25, colorBlue, colorYellow);
	n13 = SetNumber(13,(n2+n)/4, 380, 330, 80, 25, colorBlue, colorYellow);
	n14 = SetNumber(14, (n2+n)/4, 480, 330, 80, 25, colorBlue, colorYellow);
	
	n15 = SetNumber(15, (n2+n)/2 , 180, 420, 80, 25, colorBlue, colorYellow);
	n16 = SetNumber(16, (n2+n)/2, 280, 420, 80, 25, colorBlue, colorYellow);
	n17 = SetNumber(17, (n2+n)/2, 380, 420, 80, 25, colorBlue, colorYellow);
	n18 = SetNumber(18, (n2+n)/2, 480, 420, 80, 25, colorBlue, colorYellow);
	
	n19 = SetNumber(19, (n2+n)/2, 180, 510, 80, 25, colorBlue, colorYellow);
	n20 = SetNumber(20, (n2+n)/2, 280, 510, 80, 25, colorBlue, colorYellow);
	n21 = SetNumber(21, (n2+n)/2, 380, 510, 80, 25, colorBlue, colorYellow);
	n22 = SetNumber(22, (n2+n)/2, 480, 510, 80, 25, colorBlue, colorYellow);
	
	
	///////////////////////////////        LABEL        /////////////////////////////////////////
	          //HIGH First (add it manually from the moon trading system application ( desktop pc) ) //
	GfxLabel(" HFFM: "+n, 10, 30, 140, 30, 1);
	         //LOW LAST (add it manually from the moon trading system application ( desktop pc)) // ************************** to remmember  **********( convert the date or find the equivalent date  for the hi point and low point
	GfxLabel(" LLFM: "+n2, 350, 30, 140, 30, 1); // 110, 30, 140, 30, 1) LIFT / RIGHT, HIGHT/LOW, 140, 30, 1
	         //Waning(gibbous + quarter) 6 DAYS//
 	GfxLabel("WAN GQ: ", 0, 150, 140, 30, 1);
 	         //  Waning( quarter + crescent) 6 DAYS //
    GfxLabel("WAN QC: ", 0, 240, 140, 30, 1);
             // Dark Moon) 3 DAYS+ MISSING 3 DAYS //
    GfxLabel(" DM: ", 0, 330, 140, 30, 1);
             // waxing (crescent+ quarter) 6 DAYS //
     GfxLabel(" WAX CQ: ", 0, 420, 140, 30, 1);
             //  waxing ( quarter + gibbous) 6 DAYS //
       GfxLabel(" WAX QG: ", 0, 510, 140, 30, 1);
}




x = Param("x_origin", 20, 0, 1980, 20);
y = Param("y_origin", 20, 0, 1024, 20);
demo = ParamToggle("Show Demo", "No|Yes", 1);

if (demo) {
	
	GuiDemos(x+80, y+80);
	
}

thank you

hello

I bet you know about staticvarset functions, and surprise me that in your code you dont use them. why?

@needhelp said << value in the boxes are disappear when i exit amibroker or when i hid it using the ParamToggle >>

to solve this problem you need to use them staticvarset and staticvarget and special just remember the 3rd parameter of the functions has to be true **persistent = true **

hi PanoS
i use this link to do it

https://www.amibroker.com/guide/afl/staticvarset.html

but the result is the same.

```
// start of the formula:
	tempn = StaticVarGet("n" );
	// now perform all necessary calculations using temp variable
	tempn = Nz(tempn) + EditNumber(1, 0, 45, 65, 80, 25, colorBlue, colorYellow);
	// at the end of the formula store to static
     StaticVarSet("n", tempn );
	// start of the formula:
	tempn2 = StaticVarGet("n" );
	// now perform all necessary calculations using temp variable
	tempn2 = Nz(tempn2) +  EditNumber(2, 0, 400, 65, 80, 25, colorBlue, colorYellow);  //2, 0, 200, 65, 80, 25, colorBlue, colorYellow ## SECOUND TEXTBOX, formula , LIFT / RIGHT, HIGHT/LOW, WIDTH OF THE TEXT BOX , HIGHT OF THE TEXT BOX
	// at the end of the formula store to static
     StaticVarSet("n2", tempn2 );
n = tempn;
n2 =tempn2; //2, 0, 200, 65, 80, 25, colorBlue, colorYellow ## SECOUND TEXTBOX, formula , LIFT / RIGHT, HIGHT/LOW, WIDTH OF THE TEXT BOX , HIGHT OF THE TEXT BOX

thank you

i try to add this one but nothing happened

//********************************************************************************************
// Static variable functions used in charts
//
//********************************************************************************************

function StaticName( idEdit )
{
    return Name() + idEdit;
}

procedure StaticSet( idEdit, initialValue )
{
    StaticVarSet(Name() + idEdit, initialValue);
}
 
function StaticGet( idEdit )
{
    return Nz(StaticVarGet(Name() + idEdit));
}
 
procedure StaticSetText( idEdit, initialValue )
{
    StaticVarSetText(Name() + idEdit, initialValue);
}
 
function StaticGetText( idEdit )
{
    return StaticVarGetText(Name() + idEdit);
}

//********************************************************************************************

Hi
both of the above codes are wrong
please next time you need to write here a small example of your problem to solve, to be easy for the members of the forum

please read below code carefully
the are only 3 steps to read and digest

  1. type a text in the GuiEdit button
  2. Hit the Enter on your keyboard to store the value in the staticvar Flags = notifyHitReturn
  3. retrieve the value StaticVarGettext( Prefix + 21)

@needhelp i hope you enjoy this

// this example is only few lines, and Not any Custom function to be easy for reading and understand
// https://forum.amibroker.com/t/hid-show-and-save-in-gfx/31288/5

Prefix = Name()+"GuiIdVal";
Xpx=Status( "pxchartwidth");

Flags = notifyHitReturn | notifyEditChange;
// Note : After you type a text in the Gui edit button you need to hit the ENTER button of your keyboard
GuiEdit( 21, Xpx-110, 10, 50, 20, Flags );
GuiEdit( 22, Xpx-110, 31, 50, 20, Flags );
id = GuiGetEvent( 0, 0 ); 	event = GuiGetEvent( 0, 1 );

// here is the staticVar that store the value in the hard-drive (read the AB documentation) 
if( id == 21 ) StaticVarSettext( Prefix + 21, GuiGetText( 21 ),1 );
if( id == 22 ) StaticVarSettext( Prefix + 22, GuiGetText( 22 ),1 );


// below lines are as an Dummy example for chart the retrieve the Values if any  
Plot( C, "Price", colorDefault, styleCandle );
GfxTextOut("ID 21 = "+StaticVarGettext( Prefix + 21) , 50,80);
GfxTextOut("ID 22 = "+StaticVarGettext( Prefix + 22) , 50,100);

is there button in code. I do not see it
AB documentation i read it
thank you

Sorry. what do you mean?

Note that. if you are in AB editor and you place your mouse over a function, then you just press F1 button on your keyboard and the documentation will appear automatically

or just follow this Using on-chart GUI controls

thank you for traying to help

1 Like

Also you can retrieve the value by adding one more Guibutton to fill the empty boxes
so all the code afl example code will be

// this example is only few lines, and Not any Custom function to be easy for reading and understand
// https://forum.amibroker.com/t/hid-show-and-save-in-gfx/31288/7

Prefix = Name()+"GuiIdVal";
Xpx=Status( "pxchartwidth");

Flags = notifyHitReturn ;
// Note : After you type a text in the Gui edit button you need to hit the ENTER button of your keyboard
GuiEdit( 21, Xpx-110, 10, 50, 20, Flags );
GuiEdit( 22, Xpx-110, 31, 50, 20, Flags );
id = GuiGetEvent( 0, 0 ); 	event = GuiGetEvent( 0, 1 );

// here is the staticVar that store the value in the hard-drive (read the AB documentation) 
if( id == 21 ) StaticVarSettext( Prefix + 21, GuiGetText( 21 ),1 );
if( id == 22 ) StaticVarSettext( Prefix + 22, GuiGetText( 22 ),1 );

// Place the "LAST" StaticVar text back to the Guiedit box
GuiButton( "Load sV", 20, Xpx - 200, 10, 80, 20, 1 );
if( id == 20 && event == 1 )
{
    sVal21 = StaticVarGettext( Prefix + 21 );
    sVal22 = StaticVarGettext( Prefix + 22 );
    GuiSetText( sVal21, 21 );
    GuiSetText( sVal22, 22 );
}

// below lines are as an Dummy example for chart the retrieve the Values if any  
Plot( C, "Price", colorDefault, styleCandle );
GfxTextOut("ID 21 = "+StaticVarGettext( Prefix + 21) , 50,80);
GfxTextOut("ID 22 = "+StaticVarGettext( Prefix + 22) , 50,100);

GuiEdit3

1 Like

i will try to do it

thank you

i think there is misunderstand
i did not explained it right
sorry for that

https://forum.amibroker.com/t/value-in-text-box-will-disappear-gfx/31297

thank you


_SECTION_BEGIN("Moon Calendar Trading System (MCTS)");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
procedure SetOrigin(x0, y0) {
	global _x0, _y0;
	_x0 = x0; _y0 = y0;
}

procedure GfxSetColors(fgColor, bgColor) {
	GfxSetTextColor(fgColor); GfxSetBkColor(bgColor); 
	GfxSelectPen(fgColor); GfxSelectSolidBrush(bgColor);
}
procedure GfxFrame(titl,hheight, x, y, width, height, textColor, bgColor) {
	global _x0, _y0;
	x = x+_x0; y = y+_y0;
	GfxSetColors(textColor, bgColor);
    GfxRoundRect(x, y+0.5*hheight, x+width, y+height, 5, 5);
    if (titl != "") {
		w = GfxGetTextWidth(titl)*0.68; m = x+width*0.5;
		// GfxRectangle(m-w, y+1, m+w, y+hheight-1); 
		GfxRoundRect(m-w, y+1, m+w, y+hheight-1, 5, 5); 
		GfxDrawText(titl, x, y, x+width, y+hheight, 1|4|32);
		
    }
}

// Gui* part - Edit control
/*
Then modify all lines (replace EditNumber by SetNumber) starting from n3:
	n3 = SetNumber(3, (n2+n)/2, 180, 150, 80, 25, colorBlue, colorYellow);
// etc
*/
function SetNumber(idEdit, Value, x, y, width, height, textColor, bgColor) {
    global _x0, _y0;
	local rc;
	
    x = x+_x0; y = y+_y0;
    rc = GuiEdit( idEdit, x, y, width, height, 0); 
    GuiSetValue(idEdit, Value ); 
    GuiSetColors( idEdit, idEdit, 1, textColor, bgColor, textColor);
   
    return Value;
}

function EditNumber(idEdit, initialValue, x, y, width, height, textColor, bgColor) {
    global _x0, _y0;
	local rc;
	
    x = x+_x0; y = y+_y0;
    rc = GuiEdit( idEdit, x, y, width, height, 0); 
    if( rc == guiNew ) GuiSetValue(idEdit, initialValue ); 
    GuiSetColors( idEdit, idEdit, 1, textColor, bgColor, textColor);
   
    
    return GuiGetValue(idEdit);
}


 DT_VCENTER = 4 | 32; 
// format: 0 left, 1 center, 2 right
procedure GfxLabel(text, x, y, width, height, format) {
	global _x0, _y0;
	x = x+_x0; y = y+_y0;
	GfxDrawText( text, x, y, x+width, y+height, format | DT_VCENTER ); 
}


procedure GuiDemos(x,y) {
	local  n,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,
	      n12,n13,n14,n15,n16,n17,n18,n19,n20
	      ,n21,n22,txt,Prefix,Xpx,Flags;
	      
	      //// not working //////////
	/// // this example is only few lines, and Not any Custom function to be easy for reading and understand
// https://forum.amibroker.com/t/hid-show-and-save-in-gfx/31288/7
      
	Prefix = Name()+"GuiIdVal";
Xpx=Status( "pxchartwidth");
Flags = notifyHitReturn ;
// Note : After you type a text in the Gui edit button you need to hit the ENTER button of your keyboard
GuiEdit( 90, Xpx-980, 230, 50, 20, Flags );
GuiEdit(91, Xpx-1020, 230, 50, 20, Flags );
id = GuiGetEvent( 0, 0 ); 	event = GuiGetEvent( 0, 1 );

// here is the staticVar that store the value in the hard-drive (read the AB documentation) 
if( id == 90 ) StaticVarSettext( Prefix + 90, GuiGetText( 90 ),1 );
if( id == 91 ) StaticVarSettext( Prefix + 91, GuiGetText( 91 ),1 );

// Place the "LAST" StaticVar text back to the Guiedit box
GuiButton( "Load sV", 99, Xpx - 1050, 200, 80, 20, 1  );
if( id == 99 && event == 1 )
{
    sVal21 = StaticVarGettext( Prefix + 90 );
    sVal22 = StaticVarGettext( Prefix + 91 );
    GuiSetText( sVal21, 90 );
    GuiSetText( sVal22, 91 );
}
//GfxTextOut("ID 21 = "+StaticVarGettext( Prefix + 21) , 50,80);
//GfxTextOut("ID 22 = "+StaticVarGettext( Prefix + 22) , 50,100);

	// GfxSelectFont("Arial", 9); GuiSetFont("Arial", 10);
	SetOrigin(x,y);
	GfxFrame("Moon Night Calendar Trading System", 30, 0, 30, 600, 600, colorWhite, colorblack); // 30, 0, 30, 700, 180, colorWhite, colorblack(30, 0, 30, WITDTH, HIGHT, colorWhite, colorblack )
	SetOrigin(x+20,y+30);
		///////////// TEXTBOX //////////////
	n = EditNumber(1, StaticVarGettext( Prefix + 90), 45, 65, 80, 25, colorBlue, colorYellow);
	n2 = EditNumber(2, StaticVarGettext( Prefix + 91), 400, 65, 80, 25, colorBlue, colorYellow); //2, 0, 200, 65, 80, 25, colorBlue, colorYellow ## SECOUND TEXTBOX, formula , LIFT / RIGHT, HIGHT/LOW, WIDTH OF THE TEXT BOX , HIGHT OF THE TEXT BOX
	
	n3 = SetNumber(3, (n2+n)/2, 180, 150, 80, 25, colorBlue, colorYellow);//textbox # , formula , LIFT / RIGHT , HIGHT/LOW , WIDTH OF THE TEXT BOX , HIGHT OF THE TEXT BOX.
	n4 = SetNumber(4, (n2+n)/2, 280, 150, 80, 25, colorBlue, colorYellow);
	n5 = SetNumber(5, (n2+n)/2, 380, 150, 80, 25, colorBlue, colorYellow);
	n6 = SetNumber(6, (n2+n)/2, 480, 150, 80, 25, colorBlue, colorYellow);
	
	n7 = SetNumber(7,(n2+n)/3 , 180, 240, 80, 25, colorBlue, colorYellow);
	n8 = SetNumber(8, (n2+n)/3, 280, 240, 80, 25, colorBlue, colorYellow);
	n9 = SetNumber(9, (n2+n)/3, 380, 240, 80, 25, colorBlue, colorYellow);
    n10 = SetNumber(10, (n2+n)/3, 480, 240, 80, 25, colorBlue, colorYellow);
	                                                                           // add formula for missing 3 days here
	n11 = SetNumber(11, (n2+n)/4, 180, 330, 80, 25, colorBlue, colorYellow);
	n12 = SetNumber(12, (n2+n)/4, 280, 330, 80, 25, colorBlue, colorYellow);
	n13 = SetNumber(13,(n2+n)/4, 380, 330, 80, 25, colorBlue, colorYellow);
	n14 = SetNumber(14, (n2+n)/4, 480, 330, 80, 25, colorBlue, colorYellow);
	
	n15 = SetNumber(15, (n2+n)/2 , 180, 420, 80, 25, colorBlue, colorYellow);
	n16 = SetNumber(16, (n2+n)/2, 280, 420, 80, 25, colorBlue, colorYellow);
	n17 = SetNumber(17, (n2+n)/2, 380, 420, 80, 25, colorBlue, colorYellow);
	n18 = SetNumber(18, (n2+n)/2, 480, 420, 80, 25, colorBlue, colorYellow);
	
	n19 = SetNumber(19, (n2+n)/2, 180, 510, 80, 25, colorBlue, colorYellow);
	n20 = SetNumber(20, (n2+n)/2, 280, 510, 80, 25, colorBlue, colorYellow);
	n21 = SetNumber(21, (n2+n)/2, 380, 510, 80, 25, colorBlue, colorYellow);
	n22 = SetNumber(22, (n2+n)/2, 480, 510, 80, 25, colorBlue, colorYellow);
	
	
	///////////////////////////////        LABEL        /////////////////////////////////////////
	          //HIGH First (add it manually from the moon trading system application ( desktop pc) ) //
	GfxLabel(" HFFM: "+n, 10, 30, 140, 30, 1);
	         //LOW LAST (add it manually from the moon trading system application ( desktop pc)) // ************************** to remmember  **********( convert the date or find the equivalent date  for the hi point and low point
	GfxLabel(" LLFM: "+n2, 350, 30, 140, 30, 1); // 110, 30, 140, 30, 1) LIFT / RIGHT, HIGHT/LOW, 140, 30, 1
	         //Waning(gibbous + quarter) 6 DAYS//
 	GfxLabel("WAN GQ: ", 0, 150, 140, 30, 1);
 	         //  Waning( quarter + crescent) 6 DAYS //
    GfxLabel("WAN QC: ", 0, 240, 140, 30, 1);
             // Dark Moon) 3 DAYS+ MISSING 3 DAYS //
    GfxLabel(" DM: ", 0, 330, 140, 30, 1);
             // waxing (crescent+ quarter) 6 DAYS //
     GfxLabel(" WAX CQ: ", 0, 420, 140, 30, 1);
             //  waxing ( quarter + gibbous) 6 DAYS //
       GfxLabel(" WAX QG: ", 0, 510, 140, 30, 1);
}

x = Param("x_origin", 20, 0, 1980, 20);
y = Param("y_origin", 20, 0, 1024, 20);
demo = ParamToggle("Show Demo", "No|Yes", 1);

if (demo) {
	
	GuiDemos(x+80, y+80);
	
}

i add your code with some modification
but not working
you used 21 and 22 (i have the in the code as number of text box)

the ID21 and ID22 ( what the need of them i did not get it. )

n = EditNumber(1, StaticVarGettext( Prefix + 90), 45, 65, 80, 25, colorBlue, colorYellow);
	n2 = EditNumber(2, StaticVarGettext( Prefix + 91), 400, 65, 80, 25, colorBlue, colorYellow);

thank you

your code is working when i use it alone

when i change the sheet and get back .
this what is happened
error

thank you

Hi
was nice try of you. You was nearly there.

But to solve this Query you need to change only this custom function

function EditNumber( idEdit, initialValue, x, y, width, height, textColor, bgColor )
{  // this function hold the text for the next restart of Amibroker
    global _x0, _y0;
    local rc ;

    x = x + _x0;     y = y + _y0;
    rc = GuiEdit( idEdit, x, y, width, height, notifyHitReturn ); //

    ID = GuiGetEvent( 0, 0 );     event = GuiGetEvent( 0, 1 );
    if( ID == idEdit ) StaticVarSetText( "sV" + idEdit,  GuiGetText( idEdit ), 1 );

    if( rc == guiNew )
    {  // after restart Amibroker read FIRST these Static Line
        txt = StaticVarGettext( "sV" + idEdit );
        GuiSetText( txt, idEdit );
    }

    GuiSetColors( idEdit, idEdit, 1, textColor, bgColor, textColor );

    return GuiGetValue( idEdit );
}
1 Like

I can tell you a secret, but don't tell anyone
It was hard for me to solve it
thanks a lot

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.