June 17, 200916 yr The light comes on when the rudder is turned, but does not go off when the rudder returns to center without SET_OFF_SCREEN.I have run into this on several other occasions and am at a loss as to why it is required. Any clues?ThanksFredvoid FSAPI nosewheel_lights_gcb (PGAUGEHDR pgauge, int service_id, UINT32 extra_data){ switch(service_id) { case PANEL_SERVICE_PRE_UPDATE: SET_OFF_SCREEN(pgauge->elements_list[0]); // <--- why??? break; }}//---------------------------------------------------------------------------FLOAT64 FSAPI nw_l_cb ( PELEMENT_ICON pelement ){ lookup_var (&on_ground); FLOAT64 val = (pelement->source_var.var_value.n); if (val < -0.30 && on_ground.var_value.n == 1.0) return 1; // on else return -1; // off} MAKE_ICON( nosewheel_lights_left, NW_LIGHT_ON, NULL, nosewheel_lights_fail, IMAGE_USE_TRANSPARENCY | IMAGE_USE_BRIGHT, 0, 13,35, RUDDER_DEFLECTION, nw_l_cb, ICON_SWITCH_TYPE_SET_CUR_ICON, 1, 0, 0)PELEMENT_HEADER nosewheel_lights_left_list[] ={ &nosewheel_lights_left.header, NULL};//--------------------------------------------------------MAKE_STATIC( nosewheel_lights_background, NW_LIGHTS_BG, &nosewheel_lights_left_list, NULL, IMAGE_USE_TRANSPARENCY, 0, 0,0)PELEMENT_HEADER nosewheel_lights_list = &nosewheel_lights_background.header;
June 17, 200916 yr Commercial Member SET_OFF_SCREEN forces the element to be updated. Most times I've only found this to be necessary is if the macro did not have the IMAGE_USE_ERASE flag declared (which appears to be your case) but there are other uses for it e.g. forcing the text forecolour to change. FLOAT64 FSAPI chklist_line1_string_cb(PELEMENT_STRING pelement){ pelement->fg_color=line1_forecolour; //Change the text colour on the fly where line1_forecolour contains the RGB definition SET_OFF_SCREEN(pelement); //Force the text to update wsprintf(pelement->string, "%30s",chklist_line1); return 0;} -Dai
June 18, 200916 yr Author That was it Dai. I knew what SET_OFF_SCREEN was for but I didn't make the connection to the ERASE flag.I've run into that a few times over the years and was never smart enough to figure it out.ThanksFred
Create an account or sign in to comment